awk not printing variables as expected -
trying hard awk print out following variables. no matter how tried,
awk -f, -v x=$client_id -v y=$branch -v z=$uuid -v b=$hermes_group_csv_id 'begin { ofs = ","; ors = "\n" } { if (length($3) == 0) { printf "\nclient $x @ $y linux system time: $z pacific time: $b #####: column 3, row "; printf nr; printf " data missing in client $x group input csv. please check\n" } }' ${input_file} it prints out
client $x @ $y linux system time: $z pacific time: $b #####: column 3, row 249 data missing in client $x group input csv. please check could guru enlighten? thanks.
you using $x variable reference, $ in awk reference fields in input. variables used without decoration, x. so:
awk -f, -v x=$client_id -v y=$branch -v z=$uuid -v b=$hermes_group_csv_id 'begin { ofs = ","; ors = "\n" } { if (length($3) == 0) { print "\nclient "x" @ "y" linux system time: "z" pacific time: "b" #####: column 3, row "; printf nr; printf " data missing in client "x" group input csv. please check\n" } }' ${input_file} it looks x quoted here, not: point have x appear not in quoted string, can expanded variable.
Comments
Post a Comment