Search code examples
bashawkgrepless-unix

Is it possible to output the contents of more than one stream into separate columns in the terminal?


For work, I occasionally need to monitor the output logs of services I create. These logs are short lived, and contain a lot of information that I don't necessarily need. Up until this point I've been watching them using:

grep <tag> * | less

where <tag> is either INFO, DEBUG, WARN, or ERROR. There are about 10x as many warns as there are errors, and 10x as many debugs as warns, and so forth. It makes it difficult to catch one ERROR in a sea of relevant DEBUG messages. I would like a way to, for instance, make all 'WARN' messages appear on the left-hand side of the terminal, and all the 'ERROR' messages appear on the right-hand side.

I have tried using tmux and screen, but it doesn't seem to be working on my dev machine.


Solution

  • Try doing this :

    FILE=filename.log
    vim -O <(grep 'ERR' "$FILE") <(grep 'WARN' "$FILE")