[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Importing Shell Variables in to awk from Shell Scripts



"Bruno Hertz" writes:
>The last point applies, because it's not about importing shell
>vars, but your awk syntax is wrong. Your first example is almost
>correct, though. Just decide whether you want string comparison
>or regex match:
>
>awk '($6 == "'"$searchvar"'") {print $0}' "$inputfile"
>awk '($6 ~ /'"$searchvar"'/) {print $0}' "$inputfile"

	Thank you.  It is string matching I am doing here, but the big
mistake was in failing to escape the single quote with double quotes.
The shell ate them, ruining the syntax.



Reply to: