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
One way is to let awk read rules from stdin using (heredoc or here string) but process real files or files created by subprocess substitution, like this
awk -f- <(df) <<'EOF'
BEGIN{
print "test"
}
{print $3}
EOF
-f-
should appear before <(df)
. The delimiter for the heredoc should be quoted so that the $
signs will be passed into awk instead of being expanded.