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



On Mon, Jan 26, 2009 at 6:03 PM, Ben Eisenbraun <bene-Gk2boCrsRs1AfugRpC6u6w at public.gmane.org> wrote:
> instead:
>  $ files=(`awk -F, '{printf $1" "}' test.csv`)
>  $ echo $files
> catname1.dat
>  $ echo ${files[@]}
> catname1.dat foo.txt foo1.txt foo2.txt foo3.txt foo4.txt

For reference, I tried:
files=`awk -F, 'BEGIN { print "("} {print $1} END {print ")"}`
which doesn't work. Plus Ben's way is a lot simpler and cleaner-looking :--)

Gordon






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