Am running GnuWin32
under Windows 7
. Have file with this structure:
|<text_0>
<text_1>
<text_2>
until
<text_16>
|<text_0>
<text_1>
<text_2>
until
<text_12>
|<text_0>
<text_1>
<text_2>
until
<text_31>
< more of the same >
There is a variable number of lines between lines that begin with the pipe
(the separator symbol).
Desired output:
|<text_0><text_1><text_2> until <text_16>
|<text_0><text_1><text_2> until <text_12>
|<text_0><text_1><text_2> until <text_31>
In Windows (therefore double quotes) have tried (from aypal singh and Ed Morton)
awk "{ ORS = (NR%2 ? FS : RS) } 1" < in.txt > out.txt
But this does not "skip" appending a line to the previous line if the line begins with a pipe
.
How can I amend the awk
program to append all lines to the previous line until awk
encounters the record separator pipe
(and continue processing until the end of the file)?