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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for something like 'wc -l' for a binary file

Status
Not open for further replies.

elspethB

Programmer
Dec 13, 2001
6
US
I need to get a line count on binary files. The files are being ftp'd from a mainframe in EBCDIC format to a unix server and are read by an application running on that server. I would like to verify the record count before submitting an overnight process using the file. Since the binary file doesn't contain recognisable EORs, the wc -l command returns 0. Any thoughts on how to obtain a record count? Changing to a non-EBCDIC format is not an option here.
 
Changing to a non-EBCDIC format is not an option here
Even like this ?
dd conv=ascii if=/path/to/ebcdicfile | wc -l

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
If the records are all the same length, count the characters and divide by record length?

HTH,

p5wizard
 
That might do it. I wasn't aware of the 'dd' command. Thanks for your quick reply.
 
strings" is a useful command to view binary files.

strings binfile |wc -l

strings binfile| tail or head
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top