I have problem with command awk in bashI want to find pattern with variable, but it doesn't work. Can you tell me what's wrong with this line?awk -F   /$PWD/ {print $1,$3}  file.txt
awk pattern with variable in a bash script
bash;shell script;awk;quoting;variable
Since you have been using double quotes, any $-variables will be expanded by bash before they reach awk. That's the first problem: { print $1, $3 } will expand to { print , }.Next, the awk syntax you are trying to use is /<regular expression>/ { <action> }: the regular expression is not allowed to contain any unquoted slashes, but $PWD certainly contains some. That's the second issue.You could try something like this instead:/${PWD//\//\\/}/ { print \$1, \$3 }This asks bash to replace any occurrences of / in $PWD with \/, and also escapes the $ signs of $1 and $3 so that bash leaves them intact.