Computing.Net > Forums > Solaris > tail -f and pipes

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

tail -f and pipes

Reply to Message Icon

Original Message
Name: James
Date: May 24, 2002 at 15:01:45 Pacific
Subject: tail -f and pipes
Comment:

I use solaris 5.2 at work, and use a tail -f process to interactively monitor events added to the syslog file. How can I filter out events (apart from the syslog.conf file) by piping to a grep command? Thanks.


Report Offensive Message For Removal


Response Number 1
Name: PaulS
Date: May 25, 2002 at 16:54:20 Pacific
Reply:

Take a look at the grep -v option.


Report Offensive Follow Up For Removal

Response Number 2
Name: James
Date: May 26, 2002 at 12:39:28 Pacific
Reply:

I know that's what I would normally do, but Solaris 5.2 doesn't seem to allow piping tail -f. Normally, I would tail -f | grep -v word. But, it seems that is not allowed, so I'm looking for an alternative. Thanks.


Report Offensive Follow Up For Removal

Response Number 3
Name: Mark M
Date: May 27, 2002 at 08:33:11 Pacific
Reply:

That's strange....If it's just one word then How about

tail -f file | awk '$1 !="word"{print $0}'

(change $1 to whatever field the word appears in)

Or

tail -f file | awk '$0 !~ /word/ {print $0}'

Hope that helps.


Report Offensive Follow Up For Removal

Response Number 4
Name: James
Date: June 5, 2002 at 18:59:34 Pacific
Reply:

The problem is that tail -f won't work with any pipe. I think syslog-ng, the next generation version allows filtering. We'll probably have to go with something like that.


Report Offensive Follow Up For Removal

Response Number 5
Name: Zedi
Date: June 6, 2002 at 12:53:02 Pacific
Reply:

There is no such thing as Solaris 5.2. If you're saying that you're running SunOS 5.2 (Solaris 2.2), you're quite behind, and I don't even think you can get security patches for it. Consider upgrading. Legacy software written properly should be fully supported on the newer OSes.


Report Offensive Follow Up For Removal


Response Number 6
Name: James
Date: June 13, 2002 at 18:36:55 Pacific
Reply:

Thanks for the correction. You are right that it's SunOS 5.2 (still learning this stuff). As for the upgrade suggestion, I'm low on the food chain, but I'll pass the suggestion to upgrade along.


Report Offensive Follow Up For Removal






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Solaris Forum Home



Results for: tail -f and pipes

How to grep (say)last-3 and next-3
    Summary: Hi All, OS-Type=Sun-OS 5.8 Sparc9 Processor Can I grep the previous 4 lines and next 4 lines of a matched pattern(context grep)? For example here we need to monitor logs of live traffic.The data obtai...
www.computing.net/answers/solaris/how-to-grep-saylast3-and-next3-/5045.html

finding and copying files
    Summary: I am trying to find a command or develop a script that will search for a group of files with a particular extension that are all residing in different subdirectories, take the output of that find comm...
www.computing.net/answers/solaris/finding-and-copying-files/1444.html

Unix Background Process
    Summary: Rits,( What a cute name) :) you can bring the background process in foreground if u started it as job. You might be interested to know how u have to do this. Just a quick note u can start the proce...
www.computing.net/answers/solaris/unix-background-process-/4610.html








Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes Today.
Discuss in The Lounge
Poll History






Data Recovery Software