[KLUG Members] Parsing a Text file

Tony Gettig tony at gettig.net
Wed Jul 20 12:41:28 EDT 2005


On Wed, 2005-07-20 at 10:42 -0400, Andrew Eidson wrote:
> Hello all.. I was wondering what is the best way to Parse a fixed length
> text file in linux.. I have a file that is 900 Characters long and needs to
> be broken out into a comma or tab delimited file so I can then import it
> into another database application. The application does not handle fixed
> length files with no delimiters... For those of you in schools you may have
> something since this is a State SRSD file that I need to Parse.. but just
> wondering what I should use. 

I work at a school district and I've used cut and perl for such
operations in the past. Not specifically SRSD, but similar datasets.
Perl has been the most flexible for me, but I think it is worth seeing
whether cut will do the job for you. I didn't have time to master awk,
but it may very well work too. All three tools are readily available in
most standard distro installs.

Good luck!



More information about the Members mailing list