Home > Software design >  awk cannot print strings on windows
awk cannot print strings on windows

Time:11-23

Is there something I'm doing wrong?

this gives an output:

echo "hello world" | awk '{ print $0 }'

this does not:

echo "" | awk '{ print "hello world" }' (neither does awk 'BEGIN{ print "hello world" }')

this is gnu awk on windows.

For the purpose of this question, all I'd like to do is print a string. This runs as expected on WSL/MSYS etc., but doesn't produce output when on windows (using powershell, with awk from git's linux tools and with awk installed from choco, same result. )

I couldn't find any questions regarding this specific issue on stack overflow, but perhaps there is a simple difference in how strings are handled on windows vs linux?

See enter image description here

  • Related