LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-10-2014, 05:59 PM   #1
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Rep: Reputation: 5
Extract IP


I am not having any success in extracting an IP:

currentSSHrec="POSSIBLE BREAK-IN ATTEMPT 12.34.567.890 xyz"

echo $(grep -o -P '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' <<<$currentSSHrec)

Anyone know how to make this work?
Thanks.
 
Old 11-10-2014, 06:20 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,641

Rep: Reputation: 2091Reputation: 2091Reputation: 2091Reputation: 2091Reputation: 2091Reputation: 2091Reputation: 2091Reputation: 2091Reputation: 2091Reputation: 2091Reputation: 2091
Obvious first step would be to lose the "-P".
Then start trying to figure out how to make it (truly) perl-regex.
 
Old 11-10-2014, 06:35 PM   #3
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Original Poster
Rep: Reputation: 5
Thanks. I had dropped the -o but didn't try the -P.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't extract anything junior-s Linux - Software 3 09-21-2013 02:32 AM
Extract thedoctor Linux - Software 2 02-17-2010 09:18 AM
where to extract? Damon Spector Linux From Scratch 2 11-09-2005 08:08 PM
No extract in 10.2 LE EliasAlucard Mandriva 8 05-21-2005 01:38 PM
extract help emperor13 Linux - General 1 12-02-2001 11:07 AM


All times are GMT -5. The time now is 04:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration