Need to delete last 2 records in a flat file
Posted: Tue Nov 30, 2010 5:49 pm
I have fixed flat files, that have two bad records at the end of the files.
The last record it has, I think is a carriage return, but not sure, looks like:
The other record has "99999999007563" plus 300 blank spaces. The last digits of this number is the record count.
All other records are only 200 characters long.
Loading this file in server was no problem but we are migrating to parallel and UNIX and it aborts because of this two records.
I did a search but none of the suggestions seem to work well. I was able to use the sed '/999999990/d' <file name> to eliminate one of the records but I am concerned that might find a record in the file with 999999990 and delete that record as well. Also I did not know how to eliminate the , it would not compile.
Your help is much appreciate it!![Smile :)](./images/smilies/icon_smile.gif)
The last record it has, I think is a carriage return, but not sure, looks like:
The other record has "99999999007563" plus 300 blank spaces. The last digits of this number is the record count.
All other records are only 200 characters long.
Loading this file in server was no problem but we are migrating to parallel and UNIX and it aborts because of this two records.
I did a search but none of the suggestions seem to work well. I was able to use the sed '/999999990/d' <file name> to eliminate one of the records but I am concerned that might find a record in the file with 999999990 and delete that record as well. Also I did not know how to eliminate the , it would not compile.
Your help is much appreciate it!
![Smile :)](./images/smilies/icon_smile.gif)