Some relevant posts from LQ (
passing-vars-awk-366290 and
passing-shell-variable-into-awk-syntax-correct-interpretation-562973)
I am not getting this to output. The 2nd one seemed to be spot on, but with several manipulations, the output is blank. My purpouse, to run an
aureport -l and have it insert the hostname.
Code:
for i in node1 node2 node3
do
ssh $i aureport -l -i -ts yesterday -te today | awk -F " " '{ print $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 }' | grep "/"
done
Above, this is what works, but trying to have the output lines start with the node name.
I tried passing the $i in the form of:
Code:
awk -F " " -v i="$i" '$1 == i { print...
(with the option -F in multiple places and without -F) and this is when I get the blank results.
The postings mentioned, they were 3-5 years old and maybe there is something updated since then? Too old to add onto imho.
I'm all for digging on this, if it's me getting the quirks right .. feel free to let it stew for a bit. If there's a better way, pass a nugget over to get me started and I'll work on it. Mixture of RHEL4 and RHEL5 nodes and the end result is to use each nodes output into a master file, make a report and store in a DB.
Thanks !