Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
One option is to log it all and grep it later. and/or tail -f in another term to do the other stuff. Not sure of a way to do a one liner. But curious. tee does let you put it back out to - (/dev/stdout), but that doesn't seem to split the outputs like you seem to need.
yeah its going to be a constant telnet session thats logging multiple reboots of a machine. im saving its output to a file, and with each reboot the file gets bigger. so instead of searching through all that text im trying to either have it save the lines im looking for, or have it save another file with those lines..
You could always append a date/time stamp as part of the filename. That way it always starts a new file. And you can easily keep track of what happened and when. And sort and delete as needed. Or just ping the computer once a minute and log when ping fails. Assuming network, assuming ping sends a reply (firewall), and other things.
You might look at screen, perhaps it can help fork the processes.
in one xterm you could:
$ tail -f logfile.txt | grep -i "filter" > filteredlog.txt
and in the other you could
$ telnet perry $host | tee logfile.txt
With obvious limitations. tail needs to happen first. tail needs to be manually terminated when not relevant anymore. And the common file needs to match between processes.
Or maybe there's a grep option to output to multiple sources. stderr to screen(2) and stdout(1) to file. From stdin(0). Or something similar in tee. It does have - output, but I wasn't able to rig it to do two outputs. But I'm not that familiar with these apps.
well, i know with tee you can send it to seperate processes ... | tee >(process 1) >(process2) >(process3), but i have yet to achieve the desired results. i have tried doing a seperate process that does the grep filtering, but it doesnt quite work while the file is constantly being written to... maybe i need to post this in a scripting/programming forum lol. a lot of this is still new to me.