IPC-D-356 netlist exporter.
[geda-pcb/pcjc2.git] / tools / MergePCBPS
blob8d63529db00499ab884406ee9b945720084f904b
1 #!/bin/sh
3 # merges PostScript files created by pcb (version >= 1.4.2) into
4 # a single file for backward compatibility
6 # Usage: name files...
8 # by Thomas Nau 9/96
11 if [ $# -eq 0 ]; then
12 echo "Usage: `basename $0` files..." >&2
13 exit 1
16 # some system need nawk
18 case `uname` in
19 SunOS) AWK=nawk;;
20 *) AWK=awk;;
21 esac
23 $AWK '
24 BEGIN { filecount = 0; }
25 /^%!PS/ { filecount++; }
26 /^%!PS/,/^% PCBENDDATA/ {
27 if (filecount == 1)
29 if (index($0, "%%Title:") == 1)
30 sub(",.*$", ", merged layouts");
31 print $0;
32 next;
35 /^% PCBSTARTDATA/,/^% PCBENDDATA/ {
36 if (filecount > 1)
38 print $0;
39 next;
42 { next; }
43 END {
44 print "showpage";
45 print "%%EOF";
47 ' $@