For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > May 2005 > REQ: please me. "get data from line in Perl under Linux" TIA









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author REQ: please me. "get data from line in Perl under Linux" TIA
john

2005-05-09, 3:57 pm

please help to get the number of the following example line:

RX bytes:55313 (54.0 Kb) TX bytes:55313 (54.0 Kb)

i could filter this line from the ifconfig command, but how can i get
the bytes, "55313", from the line?
many thanx in advance

john
Gunnar Hjalmarsson

2005-05-09, 3:57 pm

john wrote:
> please help to get the number of the following example line:
>
> RX bytes:55313 (54.0 Kb) TX bytes:55313 (54.0 Kb)
>
> i could filter this line from the ifconfig command, but how can i get
> the bytes, "55313", from the line?


Extract them by help of the m// operator.

perldoc perlop (where the m// operator is described)
perldoc perlretut (where you find more about regular expressions
in general including more extracting examples)

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com