Combine multiple line segment into one, when certain pattern is found - awk/sed/perl
Dear Group,
I have a file with the content in the following format:
Junk...
Junk...
Heading P01
column1 column2 multiline text
CA1001 10 This is a multiline
text spanning two lines
CA1005 12 This is a multiline
text spanning three
lines
CA1008 11 This is a single line text
Heading P02
column1 column2
CA2001 10
CA2003 11
CA2005 12
Heading P03
Junk..
Junk..
I would like to list all the values under "Heading P01" for the same
column1 in a single line
CA1001 10 This is a multiline text spanning two lines
CA1005 12 This is a multiline text spanning three lines
CA1008 11 This is a single line text
Note: The column1 values will always have "CA" as the starting
character.
Appreciate your in finding a solution using awk or perl or
sed ...
Thank you!!!!
|