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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -