Unix/Linux Go Back    

Awk to remove carriage return from 65th field

Shell Programming and Scripting

Kindly Note - This is a Single User Post by Forum Member Corona688 Regarding:
Awk to remove carriage return from 65th field.
Please Follow The Primary Link Above to View the Full Discussion.

Old Unix and Linux 03-22-2012   -   Original Discussion by pinnacle
Corona688's Unix or Linux Image
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
Join Date: Aug 2005
Last Activity: 18 May 2018, 2:59 PM EDT
Location: Saskatchewan
Posts: 22,673
Thanks: 1,177
Thanked 4,321 Times in 3,984 Posts
Why would carriage returns be wanted in any of the records, unless the entire file is delimited with \r\n ? Whether it is would be good to know.

awk -F"|" 'NF==65 { sub(/\r/, ""); T=$0; getline; print T $0; next} 1'