Sample function:
$ testfn() { echo "${1} world"; }
$ testfn hello
hello world
awk example:
$ echo "something bla bla2"|awk '$1 ~/something/ { print $0; }'
something bla bla2
Now I want to change "something" to "something world" using created above function, when printing it as a whole line, by passing first awk " column element" as a parameter:
$ echo "something bla bla2"|awk '$1 ~/something/ { $1="'"$(testfn) $1"'" ; print $0 }'
world bla bla2
^^ Above doesn't work
Is there any way to pass parameters from awk to the function inside awk ?