Page 1 of 1

Problem with restrict to lines not matching

Posted: Mon Aug 23, 2004 2:59 pm
by hr
I got a problem with restrict to lines not matching.

Restrict line not matching [ > ]
Sub filter Search & replace (Perl Pattern) :
Find pattern :
arp who-has (.*) tell (.*)

Replace
$2,$1,

Sample data:
arp who-has 10.20.1.19 tell bigswitch
linuxbox.50071 > domaincontroller.domain

The result is
,10.20.1.19,bigswitch
linuxbox.50071 > domaincontroller.domain

The result that I want is :
bigswitch,10.20.1.19,
linuxbox.50071 > domaincontroller.domain

Somehow $2 (bigswitch) and $1 (10.20.1.19) is being switched....
I couldn't figure out what's wrong.

Thanks

HR
Netmap Analytics

Posted: Tue Aug 24, 2004 7:48 am
by DataMystic Support
Use a pattern of
arp who-has (.*) tell (.*?)

Otherwise the default non-greedy match stops as soon as it can.

Try turning on prompt on replace in future to help debug these problems.

Posted: Tue Aug 24, 2004 11:31 am
by Guest
Simon Carter wrote:Use a pattern of
arp who-has (.*) tell (.*?)

Otherwise the default non-greedy match stops as soon as it can.

Try turning on prompt on replace in future to help debug these problems.
Thanks mate, it's working....
I did turn on the prompt on replace, but could not figure out what's going wrong (non-greedy match).
Probably I need to learn more.

Regards,

HR
Netmap Analytics