Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gawk into an array question



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.







BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org