> Type=0x21 Type=0x22 # Same as previous except > Label= 2200 Label= 2200 # different value for Label > blah, blah EndLevel=1 > blah, blah > > The bit that's got me stumped is how to handle the Label line. Can someone > please give me hint how to do this?
The problem I have with sed is that it's line oriented, not record oriented, and your job is record oriented. (Personally I'd use gawk.) It can be a pain to match across lines in sed, but it's possible in GNU sed. The match condition I'd try for the label line is whether the number ends in 2 zeros. You'd have to match all from the type= to the label= in one expression, and if matched, perform one or more search/replaces, and write out the result with any additional stuff you want appended after label= . You can ignore any text following label= in the same record. Does that help? Volker -- Volker Kuhlmann is possibly list0570 with the domain in header http://volker.dnsalias.net/ Please do not CC list postings to me.