[KLUG Members] To shell or not to shell...

Gettig,Tony members@kalamazoolinux.org
Mon, 08 Jul 2002 11:35:15 -0400


I hold firm the belief that every network guy is a
 frustrated programmer and vice versa. Same holds true for
 guitar players and drummers. Please bear with me, as I am
 more of a network guy. :)

I need to take an export file, and process it to two
 different output files. The file is currently in a fixed
 width, one record per line format. It needs to go to an
 LDIF file and a DOS batch file, both of which are plain
 text.

I'm trying to figure out how I can process this export file
 one line at a time in a shell script, but I'm starting to
 think I can't. I'm thinking I need to write a little C
 program to read each line into an array, walk through it
 as necessary, and write out to the text files. I'd rather
 do it with bash, but am failing to find how. Everything I
 read about I/O with shell scripts is just redirection.
 Nothing on how to open a file for reading line by line.

Ideally, I will be able to cron this thing and come to work
 in the morning after the magic has happened.

Any ideas or pointers in the right direction are
 appreciated!

Tony Gettig
http://www.penguindude.com
GBY!