Can you use heredocuments to embed AWK in a bash script?

后端 未结 6 1232
庸人自扰
庸人自扰 2021-02-05 15:54

Writing a shell script that pretty much wraps around an Awk script. I\'d like to have my syntax colouring on in the awk section so I feel there must be a better way to embed awk

6条回答
  •  灰色年华
    2021-02-05 16:32

    ugly too:

    read -r -d '' awkscript <<'EOF'
    BEGIN{ print "test"}
    {print $3}
    EOF
    df | awk "$awkscript"
    

提交回复
热议问题