Sponsored Content
Top Forums Shell Programming and Scripting Need Help: Collecting similar messages in a file Post 302158711 by radoulov on Wednesday 16th of January 2008 05:57:55 AM
Old 01-16-2008
With Awk:

Code:
awk '/^Log message:/{close(f);getline;f=$0"_log_message";next}{print>f}' filename

Use nawk or /usr/xpg4/bin/awk on Solaris.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Collecting data from TOP to a file

Is there a way to collect data from top command to a file at regular intervals. I need this on HP-UX. I need to gather resident memory usage. I know that sar will give %cpu usage. There is a pmap command which gives memory usage in solaris. Is there a similar command in HP-UX Thanks (5 Replies)
Discussion started by: sssow
5 Replies

2. Shell Programming and Scripting

replace a similar field in a file

Hello, I am having a file where I have to replace the port values with the variable I defined. The file is an extract of an xml file: <NameValuePair> <name>Service1</name> <value>tcp:32406</value> </NameValuePair> <NameValuePair> ... (2 Replies)
Discussion started by: chiru_h
2 Replies

3. Infrastructure Monitoring

Remove Similar Lines from a File

I have a log file "logreport" that contains several lines as seen below: 04:20:00 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but responded to ping 06:38:08 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but responded to ping 07:11:05 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead... (4 Replies)
Discussion started by: Nysif Steve
4 Replies

4. Infrastructure Monitoring

Remove Similar entries in a File

-------------------------------------------------------------------------------- I have a log file "logreport" that contains several lines as seen below: 04:20:00 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but responded to ping 06:38:08 /usr/lib/snmp/snmpdx: Agent snmpd appeared... (2 Replies)
Discussion started by: Nysif Steve
2 Replies

5. Shell Programming and Scripting

Collecting specific portion from a file

I have a file which contains data like a b x col1:data1 formula:data3 this is for 2 a c col1:@bkw formula:dontad ad asd as per a \ i want the data from col1 and formula to keep the col1 data in left side of excel and col2 data in right side of it (1 Reply)
Discussion started by: bmrout007
1 Replies

6. Shell Programming and Scripting

Collecting details

Hi all, I am having lots of oracle servers. I want to collect some health check details from all the server and report to one single centralized server. What would be best solution for this? OS: AIX Thanks Gopal (1 Reply)
Discussion started by: ilugopal
1 Replies

7. Shell Programming and Scripting

remove one of each similar lines in a file

Hello folks I have a question for you gurus of sed or grep (maybe awk, but I would prefer the first two) I have a file (f1) that says: (actually, these are not numbers but md5sum, but for simplicity, let's assume these numbers.) 1 2 3 4 5And I have a file (f2) that says 1|a 1|b 1|c 2|d... (3 Replies)
Discussion started by: tukuyomi
3 Replies

8. Shell Programming and Scripting

extracting lines from a file with similar first name

consider i have two files cat onlyviews1.sql CREATE VIEW V11 AS SELECT id, name, FROM etc etc WHERE etc etc; CREATE VIEW V22 AS SELECT id, name, FROM etc etc WHERE etc etc; CREATE VIEW V33 AS (10 Replies)
Discussion started by: vivek d r
10 Replies

9. Shell Programming and Scripting

Reducing text file using similar lines

Hello, I am a java programmer but want to try unix for a purpose where I need to reduce a file using its first field.. Here is the sample data: admin;2;0;; admission;8;0;; aman;1;0;; caroline;0;4;; cook;0;4;; cook;2;0;; far;0;3;; far;1;5;; I am explaining the dataset first. There... (5 Replies)
Discussion started by: shekhar2010us
5 Replies

10. Shell Programming and Scripting

Collecting header from another file

I want to add header description from a file by matching the 2nd col of another file. . The lookup file is at ftp://ftp.ncbi.nlm.nih.gov/pub/COG/KOG/kog The table file looks like comp1001565_c0_seq1 At1g14590 48.48 66 34 0 200 3 171 236 ... (1 Reply)
Discussion started by: ritakadm
1 Replies
Log::Message::Item(3pm) 				 Perl Programmers Reference Guide				   Log::Message::Item(3pm)

NAME
Log::Message::Item - Message objects for Log::Message SYNOPSIS
# Implicitly used by Log::Message to create Log::Message::Item objects print "this is the message's id: ", $item->id; print "this is the message stored: ", $item->message; print "this is when it happened: ", $item->when; print "the message was tagged: ", $item->tag; print "this was the severity level: ", $item->level; $item->remove; # delete the item from the stack it was on # Besides these methods, you can also call the handlers on # the object specificallly. # See the Log::Message::Handlers manpage for documentation on what # handlers are available by default and how to add your own DESCRIPTION
Log::Message::Item is a class that generates generic Log items. These items are stored on a Log::Message stack, so see the Log::Message manpage about details how to retrieve them. You should probably not create new items by yourself, but use the storing mechanism provided by Log::Message. However, the accessors and handlers are of interest if you want to do fine tuning of how your messages are handled. The accessors and methods are described below, the handlers are documented in the Log::Message::Handlers manpage. Methods and Accessors remove Calling remove will remove the object from the stack it was on, so it will not show up any more in subsequent fetches of messages. You can still call accessors and handlers on it however, to handle it as you will. id Returns the internal ID of the item. This may be useful for comparing since the ID is incremented each time a new item is created. Therefore, an item with ID 4 must have been logged before an item with ID 9. when Returns the timestamp of when the message was logged message The actual message that was stored level The severity type of this message, as well as the name of the handler that was called upon storing it. tag Returns the identification tag that was put on the message. shortmess Returns the equivalent of a "Carp::shortmess" for this item. See the "Carp" manpage for details. longmess Returns the equivalent of a "Carp::longmess" for this item, which is essentially a stack trace. See the "Carp" manpage for details. parent Returns a reference to the Log::Message object that stored this item. This is useful if you want to have access to the full stack in a handler. SEE ALSO
Log::Message, Log::Message::Handlers, Log::Message::Config AUTHOR
This module by Jos Boumans <kane@cpan.org>. Acknowledgements Thanks to Ann Barcomb for her suggestions. COPYRIGHT
This module is copyright (c) 2002 Jos Boumans <kane@cpan.org>. All rights reserved. This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. perl v5.12.1 2010-04-26 Log::Message::Item(3pm)
All times are GMT -4. The time now is 11:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy