In addition, from the awk command issued, is the command limited number of column as 4? The source files to be processed may have different number of columns.
Thanks all for your response, it works with 'nawk'.
However, if there is no fix number of columns in a source file, how should i tackle the situation? The example here i provided 4 columns, in actual fact the source file has more. And there are total of 4 types of source file i need to clean up the carriage return.
Example:
file 1 has 15 columns in the source file
file 2 has 27 columns in the source file
file 3 has 26 columns in the source file
file 4 has 29 columns in the source file
Is there a way to not hardcode the number of columns in nawk command?
You need something to define whether the line is full of not. There are may be other ways to get this from your file (the first line maybe) but it's impossible to see your files at a distance. Or you could learn the number as the max number of fields from exploring the file before processing.
.