![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Expect script with file input problems | meberline | Shell Programming and Scripting | 1 | 05-29-2008 05:40 PM |
| input from a file into an expect script ? | starsky | Shell Programming and Scripting | 2 | 04-16-2008 12:38 PM |
| File as input for a script | innocentspirit | Shell Programming and Scripting | 5 | 10-26-2007 01:03 AM |
| Script for reading an input file | gzs553 | Shell Programming and Scripting | 1 | 10-17-2006 07:55 AM |
| Find script with input pattern file | iguanathompson | Shell Programming and Scripting | 8 | 02-06-2006 06:23 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
As long as the number of fields are fixed (and there is no whitespace in the fields), a quick script like Code:
#!/bin/sh while read line do nocommas=`echo $line | tr ',' ' '` set -- $nocommas echo "$1 $2 $3 $4" done < foo.csv should do the job If there is whitespace, then use awk Code:
#!/bin/sh
while read line
do
set -- `echo $line | awk -vFS=',' '{print $1,$2,$3,$4}'`
echo "$1 $2 $3 $4"
done < foo.csv
Cheers ZB |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|