Problem with restrict to lines not matching

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
hr
Posts: 2
Joined: Tue Jul 20, 2004 12:17 pm

Problem with restrict to lines not matching

Post 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
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post 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.
Guest

Post 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
Post Reply