awk - Variable expansion in regex
问题 Why doesn't something like this work: echo 4 | awk --assign=abc=4 '/$abc/' The actual example is much more complicated. Basically I have a regex I need repeated several times so I'm storing it in abc . Is there any way to expand an awk variable in /<regex>/ ? I've tried single and double quotes, every combination. I really need that line to be single quoted because I have several double quotes, it actually looks more like awk --assign=test=something '/$test/ { a lot of stuff here inc $test