LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 05-29-2004, 08:37 AM   #1
atmguy
LQ Newbie
 
Registered: May 2004
Location: Mumbai, India
Distribution: Debian, Sarge
Posts: 8

Rep: Reputation: 0
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?
 
Old 05-29-2004, 01:56 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
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.
 
Old 05-30-2004, 10:04 AM   #3
zorba4
Member
 
Registered: Feb 2004
Location: Paris
Posts: 398

Rep: Reputation: 31
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.
 
Old 05-30-2004, 09:00 PM   #4
looseCannon
Member
 
Registered: Dec 2003
Location: Little Rock, AR
Distribution: Fedora Core 2, AIX, HP-UX, Solaris, Whitebox
Posts: 193

Rep: Reputation: 31
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.
 
Old 05-31-2004, 10:22 PM   #5
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 121Reputation: 121
How about trying a named pipe?

Code:
PIPENAME="/tmp/mypipe"

mknod $PIPENAME p

tail -f file1.log > $PIPENAME
tail -f file2.log > $PIPENAME
tail -f file3.log > $PIPENAME

grep < $PIPENAME RCODE
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
root-tail working only in rootGUI. window id option in user mode does not solve issue Emmanuel_uk Linux - Newbie 3 11-16-2005 01:04 AM
scp/ssh tail(multiple file) remote copy tpreitano Linux - General 1 08-22-2005 02:17 PM
AIX colon files rayudu AIX 2 07-09-2005 05:51 PM
AIX: cannot execute binary files felixweimann AIX 2 11-19-2004 01:40 PM
running root-tail from shell script not working Nuk Linux - Newbie 1 04-09-2004 08:56 AM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 08:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration