Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

This is file

awk -f myawkfile.awk

Now I want to return one parameter from myawkfile.awk to the current Is there any way to return a value from awk to the bash.

For example: this sudo code:

parameter = awk -f myawkfile.awk

In here parameter is the value, which I calulted that on the awk. But now I want to pass that tp the curreny bash.

share|improve this question
I don't get your question. The info you have given is too less. – Registered User Jul 27 '14 at 12:40
@RegisteredUser I did some update – lion Jul 27 '14 at 12:44

1 Answer 1

up vote 2 down vote accepted

If you want to save the output of the awk command (awk -f myawkfile.awk into a variable so you can use it later in the script, you can do something like this:

parameter=`awk -f myawkfile.awk`


parameter=$(awk -f myawkfile.awk

This means "save the output of the command to a variable called parameter". You can reference that variable later using $parameter.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.