[ILUG] joining columns/removing commas in a CSV file?

Conor Daly conor.daly at oceanfree.net
Thu Nov 16 00:01:33 GMT 2000


On Wed, Nov 15, 2000 at 09:41:11PM +0000 or so it is rumoured hereabouts, 
Conor Daly thought:

Screwup Alert!
> 
> What am I saying? You want tr and cut? You shall have tr and cut...
> 
> #!/bin/bash
> read LINE
  TEST=$?
> while [ $TEST = "0" ]; do 
>         LINE1=`echo $LINE | cut -f1-3 -d,`
>         LINE2=`echo $LINE | cut -f4-7 -d, | tr , '\40'`
>         LINE3=`echo $LINE | cut -f8-99 -d,`
>         echo $LINE1,$LINE2,$LINE3
> 	  read LINE
	  TEST=$?
> done
> 
Thassit. Definitively. I'm sure this time. I think. Maybe. Umm.

-- 
Conor Daly <conor.daly at oceanfree.net>

Domestic Sysadmin :-)




More information about the ILUG mailing list