Sorry, the last post was wrong!
Not sure how well it will cope with a HUGE file!
(I am at work so can't test fully!!!!)
Code:
cat YOUR_DATA_FILE |
sed -n '
/./ H
/^\/CLIP/ {
s/.*//
x
s/^\n//
s/\n\/CLIP/ \/CLIP/g
p
d
}
$ {
x
s/^\n//
p
}
for each line:
paste it to the hold memory ##### (the hold memory remembers the lines including the newlines )
Line starts with a '/CLIP' ?
paste it on memory, recall all memory, remove initial '\n' in hold (it adds one before pasting) remove \n before '/CLIP' in all cases
print it.
delete the line (forces read of next line)
last line, if anything in memory
remove the initail '\n' print
else do nothing
billy