Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have the following data I'm parsing:
How can I grab just 1 [111.123.164.80] [123.126.126.126]1 [111.123.164.80] [123.126.126.126] 87 000:00:00.0000.000.000 0 +6/07/2000 04:39:00 PM SNMP: Get
I was using :
... but this is grabbing the entire line.while (<DATA>) { if ($_ =~ /\d+\s+\[\d+\.\d+\.\d+\.\d+\]/) { print $_; } }
any ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex needed
by Fletch (Bishop) on Jan 30, 2003 at 18:14 UTC | |
|
Re: regex needed
by MZSanford (Curate) on Jan 30, 2003 at 18:17 UTC | |
|
Re: regex needed
by Abigail-II (Bishop) on Jan 31, 2003 at 01:28 UTC | |
|
Re: regex needed
by CountZero (Bishop) on Jan 30, 2003 at 20:00 UTC | |
|
Re: regex needed
by glwtta (Hermit) on Jan 30, 2003 at 18:23 UTC | |
|
Re: regex needed
by JamesNC (Chaplain) on Jan 30, 2003 at 20:46 UTC | |
|
Re: regex needed
by OM_Zen (Scribe) on Jan 30, 2003 at 20:52 UTC | |
|
Re: regex needed
by Anonymous Monk on Jan 30, 2003 at 18:07 UTC |