Skip to content
Advertisement

how ignore warnings to go in stderr

I’m run a command and I want to just get errors in ‍‍‍‍stderr file not warnings

JavaScript

I want to just get errors in error.txt,not warnings.

I want this output:

JavaScript

Advertisement

Answer

You can filter the stderr if you want:

JavaScript

Explanation:

JavaScript

Redirect the stderr stream to command

JavaScript

Copies lines containing ERROR to only-errors.txt file


If you want to keep a copy of all error messages, you can add tee:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement