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 .
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).
csplit Inp_File '/%%[pP]age:/'+1 {*}
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 ??
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