Declaring an awk function in bash

Viewed 1804

I have an awk script which is called by:

awk -f myawkfile.awk arguments

The awk script is called into my bash script using the same mentioned call.

Can I, instead of calling the awk script declare it as a function in my bash script. I thought it would be easy by writing an awk in front and back ticking the whole code, then to assign a function name to call it at will. Somehow it doesnt do the trick.

I am trying to do this because I don't want my script to have dependency on another script. And I am not the one who wrote the awk script. It takes a file as input , does some stuff and gives back the modified file which is used in my script.

2 Answers
Related