Linux Archive

Linux Archive (
-   Ubuntu User (
-   -   bash, (g)awk, local variables - Quoting Rules (

"franz.reitinger" 06-30-2012 06:20 PM

bash, (g)awk, local variables - Quoting Rules
To send in variable values from outside awk, you need to define them
on the command line:

awk -v mybash_a=$a -v mybash_b=$b '<awk script>'

After reading the "quoting"-rules of awk/bash I tried some different
possibilities to access bash variables inside awk.

The following code also works within a bash (script): (v 4.2.24)


awk 'BEGIN {print index("'"$a"'","'"$b"'")}'

************************************************** **********

* Mail checked by Avira virus scanner (
************************************************** **********

ubuntu-users mailing list
Modify settings or unsubscribe at:

All times are GMT. The time now is 10:45 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.