justbow has asked for the wisdom of the Perl Monks concerning the following question:
I want the output is "1-1" by grep in line by MAC Address So far i use this scripts, but doesn't work :SS-ID VLAN MAC TIME IP RSSI MODE UAPSD BW GI WMOS DHCP IDENTITY ----- ---- --- ---- -- ---- ---- ----- -- -- ---- ---- -------- 1-1 0 C4:46:19:75:C1:55 23m 192.168.5.253 -24 bgn no 20 S 4.9 ack* 1-2 0 5C:57:C8:69:8C:1E 3s 192.168.5.254 -38 bg no 20 L 4.8 ack*
Anybody can help ?my @macall = qw(print @input); foreach $line (@macall) { if ($line =~ /C4:46:19:75:C1:55:\s+(\S+)/) { $id = $1; } } print "ID = $id"; return (0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: grep in line and print
by Athanasius (Archbishop) on Jan 24, 2013 at 02:31 UTC | |
by justbow (Initiate) on Jan 24, 2013 at 04:41 UTC | |
by Athanasius (Archbishop) on Jan 24, 2013 at 05:47 UTC | |
|
Re: grep in line and print
by roboticus (Chancellor) on Jan 24, 2013 at 02:23 UTC | |
by justbow (Initiate) on Jan 24, 2013 at 02:36 UTC | |
by roboticus (Chancellor) on Jan 24, 2013 at 19:29 UTC |