gawk into an array question
Eric Chadbourne
EChadbourne-3av5VAs6qClGBRGhe+f61g at public.gmane.org
Mon Jan 26 17:40:28 EST 2009
hi all.
i'm trying to take a column in a text file and put it into an array. it appears i am making a single member instead of several members as desired. this would be an array of foo.txt, foo1.txt, foo2.txt, foo4.txt. would a kind guru point out my mistake? i'm currently fiddling with it...
-bash-3.2$ head test.csv
catname1.dat,,catname2.dat,,catname3.dat,
foo.txt,5,bar.txt,2,me.txt,1
foo1.txt,10,bar1.txt,4,me1.txt,1
foo2.txt,15,bar2.txt,5,me2.txt,2
foo3.txt,20,bar3.txt,65,me3.txt,1
foo4.txt,25,bar4.txt,4,me4.txt,2
-bash-3.2$ files=`gawk -F, '{printf $1 " "}' test.csv` #column of values
-bash-3.2$ declare -a list_files=$files
-bash-3.2$ unset list_files[0] #delete first var in array
-bash-3.2$ echo $list_files
-bash-3.2$
as you can see the echo is nothing. thanks for any tips,
eric c.
More information about the Discuss
mailing list