I have a file, in which a single record spans across multiple lines,
File 1
====
14|\n
leave request \n
accepted|Yes|
15|\n
leave request not \n
acccepted|No|
I wanted to remove the '\n charecters. I used the below code (foudn somewhere in this forum)
perl -e 'while (<>) { if (! /\|$/ ) { chomp; } print ;}' input.dat > output.dat
The above code returns the ouptut as
line 1: 14|\n
line 2: leave request accepted|Yes| (end of record)
line3: 15|\n
line 4: leave request not acccepted|No| (end of record)
still the new line characters at the begining of the field still remains and a single record is split as two records.
My expected output is
line 1: 14|leave request accepted|Yes| (end of record)
line3: 15|leave request not acccepted|No| (end of record)
Can some one please help me in this issue?