If this really is a simple subbstitution, try using gawk, it will automatically
handle the line input, and you can set the filed seperator to be the comma
(FS=,) which will parse all teh fields for you.

The shell is probabl;y not the best solution to this problem.

Cheers


Erich

On Tue, 29 Aug 2000, Aaron Binns wrote:

> I don't have any manuals handy for this one so I thought Id ask the list my
> newbie question.
> 
> I am writing a small shell script for work which reads in comma separated data
> and parses it to another program. I want to check each field to see if it is
> blank and if so exchange the blank for two single quotes (ie: '' ).
> 
> I am trying to use an if statement right now, but I cant figure out how to
> represent a blank.
> 
> if [ $field -eq "" ]
> then $do_something
> else $do_something_else
> fi
> 
> What's wrong with the above picture?
> 
> Aaron
> 
> 
> 
> 
> --
> SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
> More Info: http://slug.org.au/lists/listinfo/slug

-- 
Erich Schulz
Instrumental Technologies
PO Box 6028, Lake Munmorah, NSW 2259
Ph: (+61)0500 551 228 , Fax: (+612) 43583113
Mob: 0408 201 228


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to