[BASH] Multiplex the output of two or more commands to standard output
by ychaouche from LinuxQuestions.org on (#58M1A)
Dear #LQ,
I would like to get any errors from 3 different logs in real time on the terminal.
Separately, the three commands that would do that, if they were run in sperate terminals/consoles, would be :
1/ tail -f /var/log/mail.warn
2/ tail -f /var/log/dovecot.log | egrep -i '(warn|critic|error)'
3/ tail -f /var/log/fail2ban.log | egrep -i '(warn|critic|error)'
How can I combine these three commands into one such that the output from all three would be shown at the same time continuously ?
I know that tail -f can take more than one file, but what about the tail -f | grep commands ?


I would like to get any errors from 3 different logs in real time on the terminal.
Separately, the three commands that would do that, if they were run in sperate terminals/consoles, would be :
1/ tail -f /var/log/mail.warn
2/ tail -f /var/log/dovecot.log | egrep -i '(warn|critic|error)'
3/ tail -f /var/log/fail2ban.log | egrep -i '(warn|critic|error)'
How can I combine these three commands into one such that the output from all three would be shown at the same time continuously ?
I know that tail -f can take more than one file, but what about the tail -f | grep commands ?