All,
I'm clearly doing something wrong, and clearly am missing something about
bash and awk interaction. My script:
#!/usr/bin/bash
echo "Starting script"
while read line
do
for m in $line
do
echo "before testing: $line :: $m"
host=$(awk '{ print "wtf:" $m }')
echo "$line :: $m :: $host"
done
done < $1
It reads a file and outputs the list of names in the file, and I though
would be like:
Starting script
before testing: foo :: foo
foo :: foo :: foo
before testing: bar :: bar
bar :: bar :: bar
before testing: baz :: baz
baz :: baz :: baz
before testing: bunt :: bunt
bunt :: bunt :: bunt
However, what I get is:
Starting script
before testing: foo :: foo
foo :: foo :: wtf:bar
wtf:baz
wtf:bunt
I have isolated it to the awk command printing out the actual file
contents. However, I'm not sure how awk is looping through anything, as it
only should should have access to $line, and $line is a single line from
the file. It seems like awk is not in the loop?
thanks,
--
Daniel B. Herrington
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug