How to pass a variable in AWK - Raspberry Pi Forums


i have variable

code: select all

hour=$(date +"%l" | perl -p -e s"/[\s]+//")
have code has variable never gets awk

code: select all

awk 'p; /wed,may 4  "$hour":00pm/ {p=1}'

variable expansion doesn't happen inside strings single quotes, inside strings double quotes.

code: select all

string="hello" echo "$string there" echo '$string there' 
print

code: select all

hello there $string there 


raspberrypi



Comments