gawk into an array question
Gordon Marx
gcmarx-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Mon Jan 26 18:11:05 EST 2009
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
More information about the Discuss
mailing list