alternative to `tail -f ` allowing printing continuous stream from multiple files in multiple folders under...











up vote
0
down vote

favorite
1













This question already has an answer here:




  • How to tail multiple files using tail -0f in Linux/AIX

    7 answers




As far as I know, tail -f <filename> allows to continuously print newly appended data from one single file.



What if I need to get content from multiple files located in multiple folders under the same parent folder, then filter that content if need be, and finally print it as a real-time stream, as new data gets appended to any one of the multiple monitored files?



EDIT: the operating system is RedHat Enterprise Linux 7.4










share|improve this question









New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by Stephen Kitt, Jeff Schaller, Christopher, RalfFriedl, thrig Dec 5 at 0:03


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Did you search for multitail?
    – Kusalananda
    Dec 4 at 14:13










  • @StéphaneChazelas RedHat 7.4
    – KiriSakow
    Dec 4 at 17:57






  • 1




    Are new files or directories being created/removed there while you're tailing that folder? If yes, should they be dynamically added to the list of files to monitor? May there be hard links or symlinks?
    – Stéphane Chazelas
    Dec 4 at 18:01












  • @StéphaneChazelas yes indeed new folders with new files are dynamically added, and these new ones are to be monitored too. Please take a look at my own answer below and tell me what you think.
    – KiriSakow
    Dec 4 at 18:07















up vote
0
down vote

favorite
1













This question already has an answer here:




  • How to tail multiple files using tail -0f in Linux/AIX

    7 answers




As far as I know, tail -f <filename> allows to continuously print newly appended data from one single file.



What if I need to get content from multiple files located in multiple folders under the same parent folder, then filter that content if need be, and finally print it as a real-time stream, as new data gets appended to any one of the multiple monitored files?



EDIT: the operating system is RedHat Enterprise Linux 7.4










share|improve this question









New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by Stephen Kitt, Jeff Schaller, Christopher, RalfFriedl, thrig Dec 5 at 0:03


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Did you search for multitail?
    – Kusalananda
    Dec 4 at 14:13










  • @StéphaneChazelas RedHat 7.4
    – KiriSakow
    Dec 4 at 17:57






  • 1




    Are new files or directories being created/removed there while you're tailing that folder? If yes, should they be dynamically added to the list of files to monitor? May there be hard links or symlinks?
    – Stéphane Chazelas
    Dec 4 at 18:01












  • @StéphaneChazelas yes indeed new folders with new files are dynamically added, and these new ones are to be monitored too. Please take a look at my own answer below and tell me what you think.
    – KiriSakow
    Dec 4 at 18:07













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1






This question already has an answer here:




  • How to tail multiple files using tail -0f in Linux/AIX

    7 answers




As far as I know, tail -f <filename> allows to continuously print newly appended data from one single file.



What if I need to get content from multiple files located in multiple folders under the same parent folder, then filter that content if need be, and finally print it as a real-time stream, as new data gets appended to any one of the multiple monitored files?



EDIT: the operating system is RedHat Enterprise Linux 7.4










share|improve this question









New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












This question already has an answer here:




  • How to tail multiple files using tail -0f in Linux/AIX

    7 answers




As far as I know, tail -f <filename> allows to continuously print newly appended data from one single file.



What if I need to get content from multiple files located in multiple folders under the same parent folder, then filter that content if need be, and finally print it as a real-time stream, as new data gets appended to any one of the multiple monitored files?



EDIT: the operating system is RedHat Enterprise Linux 7.4





This question already has an answer here:




  • How to tail multiple files using tail -0f in Linux/AIX

    7 answers








rhel tail






share|improve this question









New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Dec 4 at 18:10





















New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Dec 4 at 14:11









KiriSakow

54




54




New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




marked as duplicate by Stephen Kitt, Jeff Schaller, Christopher, RalfFriedl, thrig Dec 5 at 0:03


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Stephen Kitt, Jeff Schaller, Christopher, RalfFriedl, thrig Dec 5 at 0:03


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • Did you search for multitail?
    – Kusalananda
    Dec 4 at 14:13










  • @StéphaneChazelas RedHat 7.4
    – KiriSakow
    Dec 4 at 17:57






  • 1




    Are new files or directories being created/removed there while you're tailing that folder? If yes, should they be dynamically added to the list of files to monitor? May there be hard links or symlinks?
    – Stéphane Chazelas
    Dec 4 at 18:01












  • @StéphaneChazelas yes indeed new folders with new files are dynamically added, and these new ones are to be monitored too. Please take a look at my own answer below and tell me what you think.
    – KiriSakow
    Dec 4 at 18:07


















  • Did you search for multitail?
    – Kusalananda
    Dec 4 at 14:13










  • @StéphaneChazelas RedHat 7.4
    – KiriSakow
    Dec 4 at 17:57






  • 1




    Are new files or directories being created/removed there while you're tailing that folder? If yes, should they be dynamically added to the list of files to monitor? May there be hard links or symlinks?
    – Stéphane Chazelas
    Dec 4 at 18:01












  • @StéphaneChazelas yes indeed new folders with new files are dynamically added, and these new ones are to be monitored too. Please take a look at my own answer below and tell me what you think.
    – KiriSakow
    Dec 4 at 18:07
















Did you search for multitail?
– Kusalananda
Dec 4 at 14:13




Did you search for multitail?
– Kusalananda
Dec 4 at 14:13












@StéphaneChazelas RedHat 7.4
– KiriSakow
Dec 4 at 17:57




@StéphaneChazelas RedHat 7.4
– KiriSakow
Dec 4 at 17:57




1




1




Are new files or directories being created/removed there while you're tailing that folder? If yes, should they be dynamically added to the list of files to monitor? May there be hard links or symlinks?
– Stéphane Chazelas
Dec 4 at 18:01






Are new files or directories being created/removed there while you're tailing that folder? If yes, should they be dynamically added to the list of files to monitor? May there be hard links or symlinks?
– Stéphane Chazelas
Dec 4 at 18:01














@StéphaneChazelas yes indeed new folders with new files are dynamically added, and these new ones are to be monitored too. Please take a look at my own answer below and tell me what you think.
– KiriSakow
Dec 4 at 18:07




@StéphaneChazelas yes indeed new folders with new files are dynamically added, and these new ones are to be monitored too. Please take a look at my own answer below and tell me what you think.
– KiriSakow
Dec 4 at 18:07










2 Answers
2






active

oldest

votes

















up vote
0
down vote



accepted










Use the following oneliner:



while true; do cat /path/to/numerous/folders/and/files/*/*.txt | grep "some filter" | tail -n 10; sleep 1; done



Every 1 second, the script will print 10 last lines of the filtered stream.



To break the loop, press CtrlC.






share|improve this answer








New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • Is this really what you wanted? Unlike tail -f, it will repeat the same lines over and over if there is no change, and can miss lines if more than 10 lines are added to a file in the 1-second window.
    – n.st
    Dec 4 at 23:18










  • @n.st This oneliner did the job pretty well so far. At least for the time being.
    – KiriSakow
    Dec 4 at 23:43


















up vote
-1
down vote













Try this command:



ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname & done; wait





share|improve this answer










New contributor




Alireza Kazemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • There was a typo: ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname &; done
    – Alireza Kazemi
    Dec 4 at 14:30








  • 1




    Please edit your answer to fix the typo. You don't need to comment on it.
    – roaima
    Dec 4 at 15:12




















2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










Use the following oneliner:



while true; do cat /path/to/numerous/folders/and/files/*/*.txt | grep "some filter" | tail -n 10; sleep 1; done



Every 1 second, the script will print 10 last lines of the filtered stream.



To break the loop, press CtrlC.






share|improve this answer








New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • Is this really what you wanted? Unlike tail -f, it will repeat the same lines over and over if there is no change, and can miss lines if more than 10 lines are added to a file in the 1-second window.
    – n.st
    Dec 4 at 23:18










  • @n.st This oneliner did the job pretty well so far. At least for the time being.
    – KiriSakow
    Dec 4 at 23:43















up vote
0
down vote



accepted










Use the following oneliner:



while true; do cat /path/to/numerous/folders/and/files/*/*.txt | grep "some filter" | tail -n 10; sleep 1; done



Every 1 second, the script will print 10 last lines of the filtered stream.



To break the loop, press CtrlC.






share|improve this answer








New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • Is this really what you wanted? Unlike tail -f, it will repeat the same lines over and over if there is no change, and can miss lines if more than 10 lines are added to a file in the 1-second window.
    – n.st
    Dec 4 at 23:18










  • @n.st This oneliner did the job pretty well so far. At least for the time being.
    – KiriSakow
    Dec 4 at 23:43













up vote
0
down vote



accepted







up vote
0
down vote



accepted






Use the following oneliner:



while true; do cat /path/to/numerous/folders/and/files/*/*.txt | grep "some filter" | tail -n 10; sleep 1; done



Every 1 second, the script will print 10 last lines of the filtered stream.



To break the loop, press CtrlC.






share|improve this answer








New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









Use the following oneliner:



while true; do cat /path/to/numerous/folders/and/files/*/*.txt | grep "some filter" | tail -n 10; sleep 1; done



Every 1 second, the script will print 10 last lines of the filtered stream.



To break the loop, press CtrlC.







share|improve this answer








New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this answer



share|improve this answer






New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered Dec 4 at 14:15









KiriSakow

54




54




New contributor




KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






KiriSakow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Is this really what you wanted? Unlike tail -f, it will repeat the same lines over and over if there is no change, and can miss lines if more than 10 lines are added to a file in the 1-second window.
    – n.st
    Dec 4 at 23:18










  • @n.st This oneliner did the job pretty well so far. At least for the time being.
    – KiriSakow
    Dec 4 at 23:43


















  • Is this really what you wanted? Unlike tail -f, it will repeat the same lines over and over if there is no change, and can miss lines if more than 10 lines are added to a file in the 1-second window.
    – n.st
    Dec 4 at 23:18










  • @n.st This oneliner did the job pretty well so far. At least for the time being.
    – KiriSakow
    Dec 4 at 23:43
















Is this really what you wanted? Unlike tail -f, it will repeat the same lines over and over if there is no change, and can miss lines if more than 10 lines are added to a file in the 1-second window.
– n.st
Dec 4 at 23:18




Is this really what you wanted? Unlike tail -f, it will repeat the same lines over and over if there is no change, and can miss lines if more than 10 lines are added to a file in the 1-second window.
– n.st
Dec 4 at 23:18












@n.st This oneliner did the job pretty well so far. At least for the time being.
– KiriSakow
Dec 4 at 23:43




@n.st This oneliner did the job pretty well so far. At least for the time being.
– KiriSakow
Dec 4 at 23:43












up vote
-1
down vote













Try this command:



ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname & done; wait





share|improve this answer










New contributor




Alireza Kazemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • There was a typo: ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname &; done
    – Alireza Kazemi
    Dec 4 at 14:30








  • 1




    Please edit your answer to fix the typo. You don't need to comment on it.
    – roaima
    Dec 4 at 15:12

















up vote
-1
down vote













Try this command:



ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname & done; wait





share|improve this answer










New contributor




Alireza Kazemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • There was a typo: ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname &; done
    – Alireza Kazemi
    Dec 4 at 14:30








  • 1




    Please edit your answer to fix the typo. You don't need to comment on it.
    – roaima
    Dec 4 at 15:12















up vote
-1
down vote










up vote
-1
down vote









Try this command:



ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname & done; wait





share|improve this answer










New contributor




Alireza Kazemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









Try this command:



ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname & done; wait






share|improve this answer










New contributor




Alireza Kazemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this answer



share|improve this answer








edited Dec 4 at 15:13









roaima

42.3k550115




42.3k550115






New contributor




Alireza Kazemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered Dec 4 at 14:28









Alireza Kazemi

11




11




New contributor




Alireza Kazemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Alireza Kazemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Alireza Kazemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • There was a typo: ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname &; done
    – Alireza Kazemi
    Dec 4 at 14:30








  • 1




    Please edit your answer to fix the typo. You don't need to comment on it.
    – roaima
    Dec 4 at 15:12




















  • There was a typo: ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname &; done
    – Alireza Kazemi
    Dec 4 at 14:30








  • 1




    Please edit your answer to fix the typo. You don't need to comment on it.
    – roaima
    Dec 4 at 15:12


















There was a typo: ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname &; done
– Alireza Kazemi
Dec 4 at 14:30






There was a typo: ls /path/to/files/to/be/monitored/by/tail | while read fname; do tail -f $fname &; done
– Alireza Kazemi
Dec 4 at 14:30






1




1




Please edit your answer to fix the typo. You don't need to comment on it.
– roaima
Dec 4 at 15:12






Please edit your answer to fix the typo. You don't need to comment on it.
– roaima
Dec 4 at 15:12





Popular posts from this blog

サソリ

広島県道265号伴広島線

Setup Asymptote in Texstudio