Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find error records from a large data file

Status
Not open for further replies.

mpramods

Technical User
Jun 3, 2003
50
US
I have a large data file with millions of records. The record length of the data is 605 bytes.
But some records in the file are shorter than 605 bytes. How can I find what are these error records.
Is there any way to point out those particular records or the line number of those records.


Thanks,
Pramod
 
mpramods,

This may help:

awk 'length<605' filename

John
 
can you show us what a error line might look like in contrast to a line that's O.K.?


Kind Regards
Duncan
 
This will display the line number as well as the line which is shorter than 605 characters:

awk 'length<605 {print "Line " NR ": " $0}' filename

John
 
johngiggs

That was coo.....l. It works perfectly.

Duncan, the problem was we were getting this file from mainframe to unix. We found that there were some carriage return characters in the middle of record in some records. This was causing the record to move to next line from the position where it encounters carriage return.

To figure out this problem we had to zero in on the particluar error record.

We know the reason behind the error now.

Thanks for the help johngiggs and Duncan.

Thanks,
Pramod
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top