Hi - I'm new to working with multiline records and I'm going nuts trying to do something that seems simple.
Input:
What I'd like to see is this:
Moderator's Comments:
Code tags please
i.e. each record starts with the header record and ends with the last processing data line, but only print the header record, some delimiter then the final field of the record.
I tried this:
but it only prints the very first line of the file, then all the final record lines.
Can someone tell me where I'm going wrong.
Thanks
Last edited by Scrutinizer; 05-15-2012 at 09:01 AM..
Reason: Please use code tags - again
By using a records selector "@" that is not in your file, the whole file becomes one big record. By using "\n" as the field selector, the first line becomes $1 and the last line becomes $NF.
The code from Balasejuri mostly worked, but omitted the very last "processing data" line.
Scrutinzer's code worked perfectly.
Thanks to both for your quick replies. I can stop tearing my hair out now!
---------- Post updated 16-05-12 at 10:45 AM ---------- Previous update was 15-05-12 at 01:57 PM ----------
Hi Scrutinizer - I've been trying to work out how your awk one-liner works, without success. Could you decode it for me.
Thanks
---------- Post updated at 11:46 AM ---------- Previous update was at 10:45 AM ----------
I didn't say, but sometimes the second pattern - 'processing data' - doesn't appear and there are two Header lines in a row. Scrutinizer's awk prints the last occurrence of the processing data line - can it just print the Header and move onto the next record?
Hi,
I have a input file with the following entries:
1one
2two
3three
1four
2five
3six
1seven
1eight
1nine
2ten
2eleven
2twelve
1thirteen
2fourteen
The output should be: (5 Replies)
Hi,
I have a input file with the following entries:
1one
2two
3three
1four
2five
3six
1seven
1eight
1nine
2ten
The output should be
1one
2two
3three
1four
2five
3six (2 Replies)
Dear Experts,
I need to extract specific records from one file which has multiline records.
Input file pattern is:
============
aaaaaaaa
bbbbbbbb
asdf 1234
cccccccc
dddddddd
============
aaaaaaaa
bbbbbbbb
qwer 2345
cccccccc
dddddddd (7 Replies)
I have a file like the below:
Start
<</NumCopies 0001>>
0223 098 et(5926)sh
0223 098 mt(5926)sh
End
Start
<</NumCopies 0001>>
0224 098 et(5926)sh
0224 098 mt(5926)sh
End
This file needs to be split to seperate files. Each of the seperate file will need to... (3 Replies)
I'm trying to use Awk to get the id and name fields ($1 and $2) of file1 combined with their corresponding multiline records in file2 that are separated by blank line. Both files are ordered so that the first line of file1 corresponds to the first set of multiline records in file2 and so on.
... (4 Replies)
I have i got a requirement like below.
I have input file which contains following fixed width records.
00000000000088500232007112007111
I need the full record and concatenated with ~ and characters from 1to 5 and concatenated with ~ and charactes from 10 to 15
The out put will be like... (1 Reply)
Hi All
I have a file like this
<LText>gvsvdkag<LREC>bdjvdj</LREC>nididyvv</LText>
<LText>gvsvdkag<LREC>bdj
vdj</LREC>nididyvv</LText>
<LText>gvsvdkag<LREC>b
djvdj</LREC>nididyvv</LText>
<LText>gvsvdkag<LREC>bdjvdj</LREC>nididyvv</LText>
How will i change the file to ... (9 Replies)