bash - Using single variable to pass in reference to multiple field variables in awk? -
i'd pass reference number of field variables awk , have print out value each variable each line without using loop.
for example, i'd like:
var=$1":"$3":"$4 echo "aa bb cc dd" | awk -v var=$var '{print var}'
i output of "aa:cc:dd." when try as-is, output of $1":"$3":"$4. possible number of field variables in var without doing loop?
var='$1":"$3":"$4' echo "aa bb cc dd" | awk "{print $var}"
this pass variables want literal awk print format i.e
echo "aa bb cc dd" | awk {print $1":"$3":"$4}
Comments
Post a Comment