in shell scripting there is extensive usage of
i> regular expression
ii>sed
iii>awk
can anyone tell me the suitable contexts ...i mean which one is suitable for what kind of operation.
like the reg-exp and sed seems to be doing the same job..i.e pattern matching (1 Reply)
$ cat file.txt
asd
<AA>dev
<LL>def
<RR>sha
This works for me:
$ sed -r 's/^ .*<LL>def/\t<LL>my/' file.txt
asd
<AA>dev
<LL>my
<RR>sha
But, this does not work for me:
$ sed -r 's/^\s+<LL>def/\t<LL>my/' file.txt
asd
... (1 Reply)
Hi, I need
to make some extraction . with the following input to get the right output.
input: /etc/exp/home/bin ====> output: exp
and
input: aex1234 ===> output: ex
Thanks for your help, (4 Replies)
Hi,
I am using the following piece of code for extracting some data from in between some tags ...
$text =~ /<TAG1>(.*)<\/TAG1>.*<TAG2>(.*)<\/TAG2>.*<TAG3>(.*)<\/TAG4>.*<TAG5>(.*)<\/TAG5>/;
$tag1=$1;
print "\n$tag1";
But I am getting an error like
Use of uninitialized value in... (1 Reply)
$var1="LEN";
$VAR2="CODLENTT";
now, var2 contains var1(LEN).How do i check this in perl....
whether one string is a part of another..?
if (<logic>)
{
my operation;
}
what'd be the logic.. (4 Replies)
Hi All
I am a new in scripting language and I would like help for you guys
I would like to create a file named constant.h and search into all files *.m in specific directory for a reg-exp @"LBL_]+" exp: @"LBL_75847" , and write those matchs to constant.h if there are not written (no... (15 Replies)
Discussion started by: molwiko
15 Replies
LEARN ABOUT DEBIAN
stag-handle
STAG-HANDLE(1p) User Contributed Perl Documentation STAG-HANDLE(1p)NAME
stag-handle - streams a stag file through a handler into a writer
SYNOPSIS
stag-handle -w itext -c my-handler.pl myfile.xml > processed.itext
stag-handle -w itext -p My::Parser -m My::Handler myfile.xml > processed.itext
DESCRIPTION
will take a Stag compatible format (xml, sxpr or itext), turn the data into an event stream passing it through my-handler.pl
ARGUMENTS
-help|h
shows this document
-module|m PERLMODULE
A module that is used to transform the input events the module should inherit from Data::Stag::BaseHandler
-unit|u NODE_NAME
(you should always use this option if you specify -m)
this is the unit that gets passed to the handler/transformer. this will get set automatically if you use the the -c, -s or -t options
multiple units can be set
-u foo -u bar -u boz
-writer|w WRITER
writer for final transformed tree; can be xml, sxpr or itext
-module|m MODULE
perl modules for handling events
-codefile|c FILE
a file containing a perlhashref containing event handlers - see below
-sub|s PERL
a perl hashref containing handlers
-trap|t ELEMENT=SUB
EXAMPLES
unix> cat my-handler.pl
{
person => sub {
my ($self, $person) = @_;
$person->set_fullname($person->get_firstname . ' ' .
$person->get_lastname);
$person;
},
address => sub {
my ($self, $address) = @_;
# remove addresses altogether from processed file
return;
},
}
perl v5.10.0 2008-12-23 STAG-HANDLE(1p)