shell script help

From: egold@fsa.com
Date: Tue Apr 20 2004 - 11:01:15 EDT


i need help parsing a text file in korn shell on solaris 7. I cant use
perl.
i want to grab each line of an input file then break out the columns
(probably using awk).

here is a sample input file:

TEXT,04/04/04,04/20/04,05/01/03,a description with spaces in it.
JUNK, 4324, 4323432, 324231, another description with spaces in it.
.
.
.

i was using the following code, but then the users started putting spaces
in the last column and broke my script:

for i in `cat inputfile`
do
KEY=`echo $i|awk -F, '{print $1}'`
EDATE=`echo $i|awk -F, '{print $2}'`
MR=`echo $i|awk -F, '{print $3}'`
ENDDATE=`echo $i|awk -F, '{print $4}'`
LASTCOL=`echo $i | awk '{print $5}'`
done

thanx in advance!
E
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:28:29 EDT