Homepage | Go to the content | Go to the menu | Go to the search engine

Friday 26 June 2009

VI Shortcuts

This reference guide to the vi editor presents the majority of vi commands and keys

Read the following

Merge your Postscript file with Sed and Awk

When you wish merge your Postscript files via cat command, some printers break printing after the first page. This shell script sanitize your postscript file after merge with cat command in three steps.

  • Get file header
  • Get all pages between %%Page: and %%PageTrailer
  • Add footer %%Trailer
FILEPS=file.ps
FILEMERGE=file_merge.ps
# Merge your postscript files
cat file1.ps file2.ps file3.ps > $FILEPS
 
# Sanitize your Poscript file
sed '/^%%Page:/,$d'  $FILEPS  > $FILEMERGE
awk '/%%Page:/,/%%PageTrailer/'  $FILEPS >> $FILEMERGE
echo -e '%%Trailer\n%%EOF' >> $FILEMERGE