Splitting a postscript file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Splitting a postscript file
# 1  
Old 08-23-2011
Question Splitting a postscript file

Hi ,
I have a problem ..
I have a post script file
which has text as
%%colur code :uyiu
%% pagesize :9808
%%page: 1 1
%%color:78798-
%%ufgfhre
%%Page: 2 1

I need to create two files with this one post script file .

the first file should have data till what is in %%Page: 1 1

the remaining should go to the second file ie till %%Page: 2 1

if the post script has n number of page each should go to different file

Can you please let me know how to search the %%Page: 1 2 in the post script file .
# 2  
Old 08-23-2011
Code:
nawk 'BEGIN { FILE=1 }
/^%%[Pp]age/ { close(FILE ".ps"); FILE++ }
{ print > FILE ".ps" }' < giant.ps

will separate it into 1.ps, 2.ps, ...

If you don't want the %%page to end up in any of the files, add getline; after FILE++

It needs nawk or gawk because of close, without which it might quickly exceed awk's maximum number of open files (25 or so on some systems).
# 3  
Old 08-23-2011
Code:
csplit Inp_File '/%%[pP]age:/'+1 {*}

These 2 Users Gave Thanks to Shell_Life For This Post:
# 4  
Old 08-24-2011
now i have an other problem with the split file ..

the header of the each split file has the
%%Page 3
which should be
%%Page 1 as after splitting each file will have only one page .

can this be done ??
# 5  
Old 08-26-2011
You could look at psselect from Angus Duggan's psutils, which may be a package on your Linux distribution. psselect allows you to extract a number of pages from your PS file. To split it into several one-page files you will need to wrap it in a loop. The pages directive (which I think you allude to in your last post) can be used to find the number for the loop.

For a large number of pages this would be inefficient, of course.

Andrew
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Splitting a text file into smaller files with awk, how to create a different name for each new file

Hello, I have some large text files that look like, putrescine Mrv1583 01041713302D 6 5 0 0 0 0 999 V2000 2.0928 -0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 5.6650 0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 3.5217 ... (3 Replies)
Discussion started by: LMHmedchem
3 Replies

2. Shell Programming and Scripting

Execution of loop :Splitting a single file into multiple .dat file

hdr=$(cut -c1 $path$file|head -1)#extract header”H” trl=$(cut -c|path$file|tail -1)#extract trailer “T” SplitFile=$(cut -c 50-250 $path 1$newfile |sed'$/ *$//' head -1')# to trim white space and extract table name If; then # start loop if it is a header While read I #read file Do... (4 Replies)
Discussion started by: SwagatikaP1
4 Replies

3. Shell Programming and Scripting

Splitting XML file on basis of line number into multiple file

Hi All, I have more than half million lines of XML file , wanted to split in four files in a such a way that top 7 lines should be present in each file on top and bottom line of should be present in each file at bottom. from the 8th line actual record starts and each record contains 15 lines... (14 Replies)
Discussion started by: ajju
14 Replies

4. AIX

Printing Postscript files through Infoprint Manager to a Postscript printer

Hello, I am runnning Infoprint Manager 4.3 on AIX 5.2 . There is no problem printing AFP files, but I have hit a snag trying to use "AIX DSS" or "Other Printer" actual destinations to send unconverted Postscript files to native Postscript printers. The files are big, and they print correctly,... (0 Replies)
Discussion started by: ahetzel
0 Replies

5. UNIX for Dummies Questions & Answers

Creating a PostScript File

Hi All, I have a requirement, where i have create a pdf file in unix. I have gone through few links and understood that it could be done in 2 step manner. - Create a .ps PostScript file. - Pass .ps file to p2pdf command to create the pdf. But i am having trouble creating the .ps file. I... (3 Replies)
Discussion started by: abhisheksunkari
3 Replies

6. Shell Programming and Scripting

Splitting a file in to multiple files and passing each individual file to a command

I have an input file with contents like: MainFile.dat: 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 ... (4 Replies)
Discussion started by: rkrish
4 Replies

7. Shell Programming and Scripting

change text color in postscript file

Hi everyone, I have a program that produces postscript files on the fly The color of the files produced are in black and white I want to change the text color of postscript file as the file is being produced without having to manually go into the ps file and change it myself. Any Ideas?... (5 Replies)
Discussion started by: walforum
5 Replies

8. UNIX for Dummies Questions & Answers

"convert" chops off part of postscript file?

I have images in PS that I want to convert to JPG (unfortunately, I need to use them in Powerpoint! :eek:). The problem is that the edges of the image get chopped off when I use: convert filename.ps filename.jpg So, for example, in my plots, the top and bottom labels for the x-axis are... (0 Replies)
Discussion started by: ramparts
0 Replies

9. Solaris

COnversion utility xhtml file to Postscript file

Hi, Can any suggest me some utility to convert xhtml file to postscript file format? Also tell me from where to down load such utility.. With Regards, Dattatray (0 Replies)
Discussion started by: dattatray.b
0 Replies

10. UNIX for Dummies Questions & Answers

Printing Chinese postscript file

G'day, I've a Solaris 9 box & I've configured a HP Laserjet for postscript printing. When my client prints an English postscript file, it gets printed fine. But when he sends a Chinese postscript file, there is no output at the printer. Is there anything I need to set for Chinese... (0 Replies)
Discussion started by: Albert J.
0 Replies
Login or Register to Ask a Question