perl regular expression help

U

uttamhoode

hi all,
i have around 100 perl CGI scripts in which i want to delete some
string.

String is $abc::message{M001} i want to remove $abc::message{ } so
that the string becomes M001.

if i get regular expression for the above i will change the files using
PERL command line

Regards,
uttam hoode
 
A

anno4000

hi all,
i have around 100 perl CGI scripts in which i want to delete some
string.

String is $abc::message{M001} i want to remove $abc::message{ } so
that the string becomes M001.

if i get regular expression for the above i will change the files using
PERL command line

So what have you tried and how does it fail to do what you want?

Anno
 
U

uttamhoode

got the solution

perl -pi -w -e 's/\$abc::message{(\D\d\d\d)}/$1/g;' *.cgi

this will replace all $abc::message{xxx} to xx

before it didnt work because i gave escape sequence to some special
charatcers

.....like this

perl -pi -w -e 's/\$abc\:\:message\{(\D\d\d\d)\}/$1/g;' *.cgi

Regards,
uttam hoode
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top