Perl For system admin

Perl For system admin

am 24.05.2011 06:10:03 von vishesh kumar

--bcaec5489e5b3531dd04a3fdc30f
Content-Type: text/plain; charset=ISO-8859-1

Hi Members,

I am a linux system admin. I want to use perl as a command line like sed
and awk.
For example suppose , i need to extract IP Addr from a string or file using
regrex
i mean
str="hello ip is 192.168.2.1 and data is xxx"
And i want ip addr only using Regex
echo $str | perl -pe ??????

Please guide me,

--
http://linuxmantra.com

--bcaec5489e5b3531dd04a3fdc30f--

Re: Perl For system admin

am 24.05.2011 14:05:06 von Shawn H Corey

On 11-05-24 12:10 AM, vishesh kumar wrote:
> Hi Members,
>
> I am a linux system admin. I want to use perl as a command line like sed
> and awk.
> For example suppose , i need to extract IP Addr from a string or file using
> regrex
> i mean
> str="hello ip is 192.168.2.1 and data is xxx"
> And i want ip addr only using Regex
> echo $str | perl -pe ??????
>
> Please guide me,
>

Download the module Regex::Common from CPAN:
http://search.cpan.org/~abigail/Regexp-Common-2011041701/lib /Regexp/Common.pm

The pattern Regex::Common::net matches IPv4 addresses.


--
Just my 0.00000002 million dollars worth,
Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software: Fail early & often.

Eliminate software piracy: use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: Perl For system admin

am 25.05.2011 00:45:42 von Shlomi Fish

Hi Shawn (and all),

On Tuesday 24 May 2011 15:05:06 Shawn H Corey wrote:
> On 11-05-24 12:10 AM, vishesh kumar wrote:
> > Hi Members,
> >
> > I am a linux system admin. I want to use perl as a command line like
> > sed
> >
> > and awk.
> > For example suppose , i need to extract IP Addr from a string or file
> > using regrex
> > i mean
> >
> > str="hello ip is 192.168.2.1 and data is xxx"
> >
> > And i want ip addr only using Regex
> >
> > echo $str | perl -pe ??????
> >
> > Please guide me,
>
> Download the module Regex::Common from CPAN:
> http://search.cpan.org/~abigail/Regexp-Common-2011041701/lib /Regexp/Common.
> pm
>
> The pattern Regex::Common::net matches IPv4 addresses.

The identifier for the module is "Regexp::Common" (with the "p") - not
"Regex::Common" . Your URL should be mostly OK (though KMail broke it). Minor
nitpick.

Regards,

Shlomi Fish

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Parody of "The Fountainhead" - http://shlom.in/towtf

What is is. Perceive It. Integrate it. Act on it. Idealize it.
-- Leonard Peikoff

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: Perl For system admin

am 25.05.2011 14:40:38 von Shlomi Fish

Hi Fudmer,

next time, please reply to all recipients and don't send the reply only to me.
See below for my response:

On Wednesday 25 May 2011 13:53:53 fudmer rieley wrote:
> I c/n get the referenced link to open.. said page not found?
> http://search.cpan.org/~abigail/Regexp-Common-2011041701/lib /Regexp/Common.

This link was broken due to a KMail bug, and it isn't a permanent link. See
this instead:

http://search.cpan.org/perldoc?Regexp::Common

Regards,

Shlomi Fish


--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
The Case for File Swapping - http://shlom.in/file-swap

I learned a lot from my teachers, and from my friends more than my teachers,
and from my pupils the most. -- Rabbi Hanina

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/