Remember Remember

miƩrcoles, 13 de mayo de 2009

Passing variables to gawk

It can be necessary to pass a variable from the shell to a gawk session. I found three different ways of doing so:

echo message: | gawk '{print $0, var}' var=1234

echo message: | gawk -v var=1234 '{print $0, var}'

var=1234; echo message: | gawk '{print $0, "'"$var"'"}'

More tricks here

0 comentarios:

Publicar un comentario

Suscribirse a Enviar comentarios [Atom]



<< Inicio