I use grep very often and am familiar with it\'s ability to return matching lines (by default) and non-matching lines (using the -v parameter). However, I want to be able to
I had the exact same problem and I wrote a small Perl script for that [1]. It only accepts one argument: the regex
to grep input on.
[1] https://gist.github.com/tonejito/c9c0bffd75d8c81483f9107c609439e1
It reads STDIN by line and checks against the given regex
, matched lines go to STDOUT and not matched go to STDERR.
I made it this way because this tool sits in the middle of a pipeline and I use shell redirection to save the files on their final location.