Trying to extract a column (UPC Number) from csv file and adding white spaces at the end in case the length of the file is less than 14. However the output have an ^M at the end which I do not know how to remove.This command is working for other columns except for this one.awk -F, '{print $8}' $FILE | awk '{printf(%-14s\n, $0) }' > $TEMP/upcvi output:861601000109^M736040531685^Mcat output: 61601000109 36040531685
Strange output from AWK
text processing;awk;special characters
This file was probably opened and saved in a windows text editor.The end of line character in UNIX based systems are different from that of windows. Text files created on DOS/Windows machines have different line endings  than files created on Unix/Linux. DOS uses carriage return and line  feed (\r\n) as a line ending, which Unix uses just line feed (\n).  You need to be careful about transferring files between Windows  machines and Unix machines to make sure the line endings are  translated properly.SourceWhen you cat the file, the EOL character will not be displayed, however, when you read the file using vi, it will be. The easiest way to remove ^M from the file, is probably to use the stream editor sed to remove the ^M characters. Type this command: % sed -e s/^M// filename > newfilenameTo enter ^M, type CTRL-V, then CTRL-M. That is, hold down the CTRL key then press V and M in succession.