以下を含む小さなテストファイルがあります。
awk this
and not awk this
but awk this
so do awk this
そして、bashで次のawkコマンドを試しましたが、それぞれが出力を生成しません:
f=awk; awk '/$f/ && !/not/' test.txt
f=awk; awk '/\$f/ && !/not/' test.txt
f=awk; awk '/"$f"/ && !/not/' test.txt
f=awk; awk -v f="$f" '/f/ && !/not/' gtest.txt
二重引用符を使用"
すると、!
.
同じコマンドで変数を検索し、別の文字列を否定するにはどうすればよいですか?