home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / PSUTILS / FIXWPPS.CMD < prev    next >
OS/2 REXX Batch file  |  1994-01-14  |  717b  |  33 lines

  1. extproc perl -Sx 
  2. #!perl
  3. # fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file
  4.  
  5. # feed this into perl
  6. eval 'exec perl -S $0 "$@"'
  7.    if $running_under_some_shell;
  8.  
  9. $page = 1;
  10. $nesting = 0;
  11.  
  12. while (<>) {
  13.    s/([^\/]_t)([0-9]+)/\1 \2/g;    # fix wp 5.0 bug
  14.    if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) {
  15.       print $_;
  16.    } elsif (/^(.*)(_bp.*)$/) {
  17.       print "$1\n" if $1 ne "";
  18.       print "%%Page: $page $page\n";
  19.       print "$2\n";
  20.       $page++;
  21.       $nesting++;
  22.    } elsif (/_ep$/) {
  23.       print $_;
  24.       $nesting--;
  25.    } elsif (/^(.*)(_ed.*)/) {
  26.       print "$1\n" if $1 ne "";
  27.       print "%%Trailer:\n";
  28.       print "$2\n";
  29.    } else {
  30.       print $_;
  31.    }
  32. }
  33.