Showing posts with label sed. Show all posts
Showing posts with label sed. Show all posts

Monday, March 18, 2013

Cropping Margins Existing Template PDF with PDFTK

The key of the re-centering or re-margining is the /Mediabox reference... we have to pan the original template in PDF... ON THE UNCOMPRESSED PDF... The media box [0,0,612,792]
  • Move the box up: [0 -70 612 722]
  • Move the box down: [0 70 612 862]
  • Move the box left: [70 0 682 792]
  • Move the box right: [-70 0 542 792]
 1273  pdftk S89E.pdf output S89E.unc.pdf uncompress
 1274  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[-70 0 542 812\]/g'< S89E.unc.pdf > S89.resized.pdf
Examples
 1301  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[0 70 612 862\]/g'< S89E.unc.pdf > S89.resized.pdf
 1304  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[0 -70 612 722\]/g'< S89E.unc.pdf > S89.resized.pdf
 1305  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[70 0 682 792\]/g'< S89E.unc.pdf > S89.resized.pdf
 1306  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[-70 0 542 792\]/g'< S89E.unc.pdf > S89.resized.pdf

Tuesday, May 8, 2012

sed: how do I grep from line X until EOF?

If I have a rolling logfile with multiple lines per log record how do I print from line X until EOF?
computer:~ me$ sed -n "57450,\$p" pf/app/logs/server/trace.log

Wednesday, May 2, 2012

SED: print only lines between x and y...

Print only lines between certain line numbers... I'm sick of looking this up every two seconds... so I plagiarize and put it in my own collection.... which I know how to find :-)
# print section of file based on line numbers (lines 8-12, inclusive) 
sed -n '8,12p' # method 1 
sed '8,12!d' # method 2
Example that I needed this for: grepping lines 39000 - 40000 where an error was reported.
computer:tmp user$ ssh user@host 'cd  /QIBM/UserData/WebSphere/AppServer/V61/ND/profiles/dmgrapp/logs/dmgr && sed -n '39000,40000p' systemout.log'

Saturday, June 19, 2010

Remove Non Printable Characters with sed

Took a while to find this and the exact syntax but here its, removing all non ascii chars.
$ sed 's/[^ -~]//g' < B2.java > BeanUtils.java