01-14-2008
Need Help: Collecting similar messages in a file
Hi All,
Since i am very new to shell scripting, i need help from you guys.
Suppose there is a file containing:
Log message:
Ashish
"asasasa"
asasa
asasa
asasas.info1
Log message:
Kapil
"asasasa"
asasa
asasa
asasas..info1
Log message:
Ashish
"asasasa"
asasa
asasa
asasas..info2
Log message:
Kapil
"asasasa"
asasa
asasa
asasas..info2
Log message:
Ashish
"asasasa"
asasa
asasa
asasas..info3
Now i want to create different files containing info about same log messages,which means new files should be created like this:
ashish_log_message:
containing info1..info2..info3..
Kapil_log_message:
containing info1..info2..
Hoping to get reply soon.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
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
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
--------------------------------------------------------------------------------
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
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
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
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
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
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
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
LEARN ABOUT DEBIAN
log::handler::output::forward
Log::Handler::Output::Forward(3pm) User Contributed Perl Documentation Log::Handler::Output::Forward(3pm)
NAME
Log::Handler::Output::Forward - Forward messages to routines.
SYNOPSIS
use Log::Handler::Output::Forward;
my $forwarder = Log::Handler::Output::Forward->new(
forward_to => sub { },
arguments => [ "foo" ],
);
$forwarder->log(message => $message);
DESCRIPTION
This output module makes it possible to forward messages to sub routines.
METHODS
new()
Call "new()" to create a new Log::Handler::Output::Forward object.
The following options are possible:
forward_to
This option excepts a code reference.
Please note that the message is forwarded as a hash reference. If you change it then this would have an effect to all outputs.
arguments
With this option you can define arguments that will be passed to the sub routine.
In the following example the arguments would be passed as a array to "Class::method()".
my $forwarder = Log::Handler::Output::Forward->new(
forward_to => &Class::method,
arguments => [ $self, "foo" ],
);
This would call intern:
Class::method(@arguments, $message);
If this option is not set then the message will be passed as first argument.
log()
Call "log()" if you want to forward messages to the subroutines.
Example:
$forwarder->log("this message will be forwarded to all sub routines");
validate()
Validate a configuration.
reload()
Reload with a new configuration.
errstr()
This function returns the last error message.
FORWARDED MESSAGE
Note that the message will be forwarded as a hash reference.
If you make changes to the reference it affects all other outputs.
The hash key "message" contains the message.
PREREQUISITES
Carp
Params::Validate
EXPORTS
No exports.
REPORT BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>.
If you send me a mail then add Log::Handler into the subject.
AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
COPYRIGHT
Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-11-21 Log::Handler::Output::Forward(3pm)