SUMMARY: Answers to "want to use command line string args in awk prog"

SUMMARY: Answers to "want to use command line string args in awk prog"

Post by Roger Squir » Fri, 24 Jan 1992 03:20:16



Thanks much to those who responded to my question below.
The range of answers indicates how important clarity and completeness are in
stating a problem as only one person interpreted the problem as I intended!

Quote:>Hello!  I want to use command line string args in an awk program, like so:
>    awkprog hello goodbye
>and then have a statement within the awk program like:
>    x = '"$argv[1]"'  
>and have
>    x = "hello"


** Try:
**        x = "'"$argv[1]"'"    ( that is: {double_q} {single_q} {double_q} )
** instead of:
**        x = '"$argv[1]"'
** Awk will not see a non-numeric constant as such unless it is
** enclosed in double quotes.  Your existing double quotes are
** interpreted by your shell, and thus never seen by awk.

This did the trick!  Thanks!


I had not known of.  Again Thanks!  These netters are pretty smart...

Roger Squires