confuseddddd
Programmer
Created a nawk script with a field separator of space and built an output file that has many records in the file and after each record of varying lengths, the record contains ^M. Want to be able to remove those carriage returns and the blank spaces that lead up to the ^M.
The script reads many header records, which are not sorted because all the detail follows each header record. Am splitting the input file into separate user files.
nawk 'BEGIN{
FS=" ";
PRE='`date -u +%Y%m%d`'
}
## get user id
if ( substr($1,1,4) == "HEADER" ) {
VAR=substr($2, 17, 3)
}
## build separate user files from input
print $0 >> PRE"_I01."VAR
}
END
I tried dtox and dos2unix but our UNIX system does not have those tools installed.
I tried sed '/^$/d' input > output and did not work
I tried grep -v "^[ ]*$" input > output and did not work
I tried awk 'length' input > output and did not work
I tried awk '/^[ ]*$/{next}{print}' input > output and did not work
Anyone have any other suggestions????
Thanks in advance.
The script reads many header records, which are not sorted because all the detail follows each header record. Am splitting the input file into separate user files.
nawk 'BEGIN{
FS=" ";
PRE='`date -u +%Y%m%d`'
}
## get user id
if ( substr($1,1,4) == "HEADER" ) {
VAR=substr($2, 17, 3)
}
## build separate user files from input
print $0 >> PRE"_I01."VAR
}
END
I tried dtox and dos2unix but our UNIX system does not have those tools installed.
I tried sed '/^$/d' input > output and did not work
I tried grep -v "^[ ]*$" input > output and did not work
I tried awk 'length' input > output and did not work
I tried awk '/^[ ]*$/{next}{print}' input > output and did not work
Anyone have any other suggestions????
Thanks in advance.