I desperately need help converting ascii data file generated on AIX platform that contains dollar sign ($) at the end of each line in the data file as shown below.
ME570^0128237^HG278999^20140805:21:00:00^BEENZ001^$
This is the AWK command for adding CR to the new line.
awk '{sub("$","\r\n"); printf("%s",$0);}' inputfile > outputfile
When I execute this AWK
command to add Carriage Return before the new line it works fine from the command line like shown below.
ME570^0128237^HG278999^20140805:21:00:00^BEENZ001^M$
but it add double CRs like CRCRLF in the ascii data file when is executed as korn shell script as shown below.
ME570^0128237^HG278999^20140805:21:00:00^BEENZ001^M^M$
Do you have a suggestion on how to resolve this issue. Any help is appreciated.
Thanks
Nnamdi