I am trying to omit the trailer record in a variable width file
I tried using awk 'NR >1 { print prev } { prev = $0 }' filename
The above command is giving output but somehow it is trimming columns from the record. For example if my record has columns A,B,C,D
The awk gives output as A,B,C
My file has field separator as tab and record separator as Form Feed Line Feed or <FF><LF>
Is this an issue with the above separators? Please suggest
Provide us the sample input data and the output for your awk command
Sample records
1 1 InPayANZ 12.0000 NZD NOW 011179099848025
2 2 InPayNonANZ 25.0000 NZD NOW 011179099848025
4 4 IP-OUR-NONANZ 20.0000 NZD NOW 011179099848025
Output
1 1 InPayANZ 12.0000 NZD
2 2 InPayNonANZ 25.0000 NZD
I am not sure if your data really contains so many empty lines, maybe you need to adapt this a bit:
sed -n '$ !p' /path/to/infile > /path/to/outfile
I hope this helps.
bakunin
awk 'NR>1{print prev} {prev = $0}' ORS='\n\n' RS= sam