The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




Thread: File Format
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 08-01-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink Guess - fixed record file without record delimiters

I see this often, where the file is fixed record length. You need to find the pattern of data and reformat accordingly.

For instance, the following is three records; each record comprising 3 datafields; each datafield of five characters.


Code:
Joe  unix 12   Prvx ps   905  era  dos  1015

Once you know the data layout - the overall record length - you can begin the process of converting the file into something you might be able to process easier.

One function I often use when confronted by this is to:


Code:
> cat myfile | od -An -t dC -w10 | more

With a handy ASCII chart, you can probably read along the data file to see what is happening.