Bash – Suppress awk warnings

awkbash

On a script, I get some warning of the form awk: warning: escape sequence \( treated as plain (.
Since I want to use the output of that script to do stuff, I want it to output only results and not warnings.

I can correct that warning easily, but is there a way to get rid of all warnings in awk?

Best Answer

Warnings and error messages are generally sent to stderr, and that seems to be the case for awk, so redirecting stderr to /dev/null should keep you from seeing those messages, like this:

awk your_options your_file 2>/dev/null
Related Question