tail multiple files not working in AIX - Help
A
tail -f file1.log file2.log file3.log | grep RCODE AIX says it can process only one file at a time. AIX version: AIX 4.3.3-11 It works on Linux, unix. We are not allowed to install gcc to make Multitail work. vanheusden.com/multitail/ Is there any workaround for this, a shell script(ksh) to tail and grep all the files into a single file in '/tmp' and then tail it perhaps? |
You could loop through every file argument and run tail on that file, piping through grep. You may want to use sed to precede each line with the filename and a colon. However if you weren't particular about how many lines at the bottom of the files were read, you could fgrep first, and tail to limit the number of matches. Then the filename would precede the match, thanks to fgrep.
|
I would try it that way :
I would write down a script like that : #startup rm /tmp/logfile.txt for i in file1.log file2.log file3.log do tail -100f $i |grep RCODE >>/tmp/logfile.txt 2>&1 & done tail -100f /tmp/logfile.txt # end script I didn't even try it, but I think that my script should work. |
Maybe you are going about this the hard way. Look at a free utility I recently managed to get installed on our AIX 5.x servers -- Swatch. It examines or tails, which ever mode you would like, files and will perform actions, print lines, email people, or do almost anything you want upon finding a match to whatever criteria you define.
Very nice. Very handy. I use it on a regular basis for going through massive log files. http://swatch.sourceforge.net. Also, I will be happy to provide a tar file with all the compiled perl modules included. All you have to do is untar them and it is ready to go. |
How about trying a named pipe?
Code:
PIPENAME="/tmp/mypipe" |
All times are GMT -5. The time now is 06:50 PM. |