BEGIN {hdr=1; pn=0; pg=""}
/^p[0-9]+$/ {
if(!hdr){
pn++
print "p" pn
printf("%s", pg)
pg = ""
}
hdr = 0
next
}
hdr {
print
next
}
$0 == "x X copypage" {
pn++
print "p" pn
printf("%s", pg)
}
!hdr {
pg = pg $0 "\n"
}
END{
if(!hdr){
pn++
print "p" pn
printf("%s", pg)
pg = ""
}
}
|