Computing.Net > Forums > Unix > How to get data from mylog.log

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to get data from mylog.log

Reply to Message Icon

Name: OMG
Date: September 13, 2002 at 16:03:52 Pacific
OS: UNIX
CPU/Ram: ??
Comment:

In mylog.log has

File Description Status
PID1 Testing1 Active
PID3 Testing2 NotActive
PID7 Testing3 NotActive
PID8 Testing4 Active
PID9 Testing5 NotActive


How do I write a script to extract information from mylog.log, let says just Description and Status?

I want to write a script that gives me the flexibility to choose which column to present to me. If I typed D and S, I will get the description column and Status column


Description Status
Testing1 Active
Testing2 NotActive
Testing3 NotActive
Testing4 Active
Testing5 NotActive
=================Second Part================

With the same log, how would I reconstruct the data into more meaningful script? Let say, If PID exist, I want it to tells me in a more meaningful way. If I do grep PID1, I would be getting
PID1 Testing1 Active

I want the to return to me as the following.

PID1 is at Active Status for Testing1.



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: September 16, 2002 at 04:21:36 Pacific
Reply:

Look at cut for the first portion and
ps -ef | grep $pid for the second. Piping the ps command through cut or awk will probably help you.


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: How to get data from mylog.log

How to Remove LILO from Windows NT boot www.computing.net/answers/unix/how-to-remove-lilo-from-windows-nt-boot-/2230.html

how to get the last field www.computing.net/answers/unix/how-to-get-the-last-field/6529.html

How to get CRON to read .profile www.computing.net/answers/unix/how-to-get-cron-to-read-profile/5351.html