Need to search a particular String form a file a write to another file using perl script
I have file which contains a huge amount of data. I need to search the pattern Message id. When that pattern is matched I need to get abcdeff0-1g6g-91g3-1z2z-2mm605m90000 to another file.
Kindly provide your input.
File is like below
Itried like this but its not working.
Last edited by Scrutinizer; 09-20-2013 at 05:08 PM..
Reason: code tags
I am very new to Perl. I am struggling so hard to search a date (such as 10/09/2009, 10-09-2009) from a text file and replace with a string (say DATE) using Perl. Please help me out. Thanks in advance.
Regds
Doren (4 Replies)
Hi,
This is the first time playing around with perl and need some help.
Assuming if i have a line of text that looks like this:
Date/Time=Nov 18 17:12:11;Device Name=192.168.1.1;Device IP=192.168.1.1;Device Class=IDS;Source IP=155.212.212.111;Source Name=UNKNOWN;Source Port=1679... (3 Replies)
hi ..
i have a problem how to search file with date and version number(ms_2.0_dd/mm/yy_24)in folder.Here 24 is version number and compare the this file to other file which is in another folder and if does not match then copy this file to respective folder.Also copy different files in different... (1 Reply)
Hi every one,
Please excuse me if any grammatical mistakes is there.
I have multiple xml files in one directory, I need to create multiple XML files into one XML file.example files like this</p>
file1:bvr.xml
... (0 Replies)
Dear all,
I have a number of files and each file has two sections separated by a blank line. At the top section, I have lines which describes the values of the alphabetical characters,
# s #; 0.123
# p #; 12.3
# d #; -2.33
# f #; 5.68
<blank line>
sssssss
spfdffff
sdfffffff
Now I... (4 Replies)
Hi,
Need your help for this scripting issue I have. I am not really good at this, so seeking your help.
I have a file looking similar to this:
Hello, i am human and name=ABCD.
How are you?
Hello, i am human and name=PQRS.
I am good.
Hello, i am human and name=ABCD.
Good bye.
Hello, i... (12 Replies)
Hello Forum.
I have a file called abc.sed with the following commands;
s/1/one/g
s/2/two/g
...
I also have a second file called abc.dat and would like to substitute all occurrences of "1 with one", "2 with two", etc and create a new file called abc_new.dat
sed -f abc.sed abc.dat >... (10 Replies)
Hello All
I have a pattern.txt file in source directory ((/project/source/) in linux server and data looks like:
123abc17
234cdf19
235ifg20
I have multiple log files in log directory (/project/log/) in linux server and data for one log file looks like:
<?xml version="1.0" processid... (11 Replies)
I have a text file which is generated when the batch job is run. This batch may take few mins to run. When completed, the last line of the text file would be process completed. I need a shell script which will wait for this file till the process completed is printed in it, once found, it would move... (2 Replies)
Discussion started by: Lalat
2 Replies
LEARN ABOUT MOJAVE
log::message::handlers5.18
Log::Message::Handlers(3pm) Perl Programmers Reference Guide Log::Message::Handlers(3pm)NAME
Log::Message::Handlers - Message handlers for Log::Message
SYNOPSIS
# Implicitly used by Log::Message to serve as handlers for
# Log::Message::Item objects
# Create your own file with a package called
# Log::Message::Handlers to add to the existing ones, or to even
# overwrite them
$item->carp;
$item->trace;
DESCRIPTION
Log::Message::Handlers provides handlers for Log::Message::Item objects. The handler corresponding to the level (see Log::Message::Item
manpage for an explanation about levels) will be called automatically upon storing the error.
Handlers may also explicitly be called on an Log::Message::Item object if one so desires (see the Log::Message manpage on how to retrieve
the Item objects).
Default Handlers
log
Will simply log the error on the stack, and do nothing special
carp
Will carp (see the Carp manpage) with the error, and add the timestamp of when it occurred.
croak
Will croak (see the Carp manpage) with the error, and add the timestamp of when it occurred.
cluck
Will cluck (see the Carp manpage) with the error, and add the timestamp of when it occurred.
confess
Will confess (see the Carp manpage) with the error, and add the timestamp of when it occurred
die
Will simply die with the error message of the item
warn
Will simply warn with the error message of the item
trace
Will provide a traceback of this error item back to the first one that occurred, clucking with every item as it comes across it.
Custom Handlers
If you wish to provide your own handlers, you can simply do the following:
o Create a file that holds a package by the name of "Log::Message::Handlers"
o Create subroutines with the same name as the levels you wish to handle in the Log::Message module (see the Log::Message manpage for
explanation on levels)
o Require that file in your program, or add it in your configuration (see the Log::Message::Config manpage for explanation on how to use
a config file)
And that is it, the handler will now be available to handle messages for you.
The arguments a handler may receive are those specified by the "extra" key, when storing the message. See the Log::Message manpage for
details on the arguments.
SEE ALSO
Log::Message, Log::Message::Item, 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.18.2 2014-01-06 Log::Message::Handlers(3pm)