Showing posts with label cut. Show all posts
Showing posts with label cut. Show all posts

Wednesday, February 6, 2013

Get a column from output and then get unique values

log example :

[02/06 06:20:01:664] [Thread-0] [ExtractJob][INFO]: ExtractJob execute started.
[02/06 06:20:01:666] [Thread-0] [Extracter][INFO]: send request for: Universe=RVUS0; ...
[02/06 06:20:04:135] [Thread-0] [Extracter][INFO]: request failed for 20130206 ....
[02/06 06:20:04:135] [Thread-0] [Extracter][INFO]: send request for: Universe=RVUS0; we....
[02/06 06:20:23:593] [Thread-0] [Extracter][INFO]: Extracting file: 36827dba-e66f-444a-b730-7.csv



print events times rounded to minutes:

[user@server ~]$ grep "ERROR" /www/logs/my.app.log | cut -d ':' -f 1,2,3 | sort | uniq

[02/06 06:20:01
[02/06 06:20:04
[02/06 06:20:23
[02/06 06:20:24

Tuesday, November 15, 2011

Cut margins for PDF file to ease reading on Kindle DX

That works best for me is: pyPdf + custom script.

Description: just specify how much should be cropped. No huge difference in size of result PDF.
Install pyPdf module: "sudo yum install pyPdf"(Fedora) or "sudo apt-get install python-pyPdf"(Ubuntu)

Save scripts to "pdf_crop.py"
Usage:
"-m" mean  margin = "left top right bottom"
Examples:
python pdf_crop.py -m "25 30 7 25" -i progit.pdf
python pdf_crop.py -m "-5 0 -5 0" -i java_concurrency_in_practice.pdf


Consider also: calibre (in ubuntu repo), k2pdfopt, PaperCrop, and pdfread.

Pdfcop is useful tool by means of it I could easily read PDFs on it. It removes margins/borders of PDF.
This tool is not ideal - it always increase size of document in 2 till 100 times, even ones from 3Mb to 540Mb.

On Fedora:
sudo yum install texlive-utils
usage:
pdfcrop input.pdf output.pdf

Ubuntu users could try.

Also consider PDFEdit application
sudo yum install pdfedit
or
sudo apt-get install pdfedit

Example of cut is here , but I failed to use it.

Additional tools that could come in handy are here.