My source file is pipe delimeted file with 53 fields.In 33 rd column i am getting mutlple new line characters,dule to that record is breaking into multiple records.
Note : here record delimter also \n
sample Source file with 6 fields :
1234|abc| \nabcd \n bvd \n cde \n |678|890|900\n
when i am trying to read it, file is reading as
1234|abc|
abcd
bvd
cde
|678|890|900
required output:
1234|abc|abcd bvd cde |678|890|900 \n
pamu
November 2, 2012, 8:47am
2
What you want to achieve with this file..?
And what you have tried so far..?
i am not able to read the file through sequential file in datastage job.
I just wanted to remove new line characters in 3 column of a file.
I am not a unix resource and i am very bad at SED & AWK commands. i am trying to take a help of google
pamu
November 2, 2012, 9:50am
4
If you want to remove "\n" from file use
sed 's/\\n//g' file
Thankyou for your reply.but this command removes all /n characters in the file. but i need /n character at the end of each record.because it is a record delimiter.
pamu
November 5, 2012, 7:47am
7
I know there should be better way..
I am not very good at sed regex..
sed 's/\\n$/_-_-_/g;s/\\n//g;s/_-_-_/\\n/' file
RudiC
November 5, 2012, 7:53am
8
Try (even though your required output does NOT fit the sample input given):
awk -F\| '{while (NF<6) {getline Xvar; $0=$0Xvar}}
1
' file
1234|abc| abcd bvd cde |678|890|900
Adapt to your needs, esp. the field separator assignment; works as is on linux/mawk.