LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-27-2006, 07:47 PM   #1
DropSig
Member
 
Registered: Apr 2004
Location: Saskatchewan
Distribution: Ubuntu, Centos
Posts: 208

Rep: Reputation: 30
grep data between two word


Failed password for invalid user ddd from xxx.xx.xxx.xx port xxxxx ssh2
i want to grep (or some other way) whats in between from and port
any idea???
 
Old 01-27-2006, 08:00 PM   #2
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Code:
sed -n 's/.* from //; s/port .*//p' filename
I am sure there are better more "correct" ways to do this, but this works.
 
Old 01-27-2006, 08:31 PM   #3
DropSig
Member
 
Registered: Apr 2004
Location: Saskatchewan
Distribution: Ubuntu, Centos
Posts: 208

Original Poster
Rep: Reputation: 30
thank you if it works, it perfect for me.
its just for ip's that keeps on trying to login through ssh, im making a script to grap the ip from the system log and block them....
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Paste of data from word to Yahoo/rediff in opera is limited to few characters sachin_keluskar Linux - Software 0 08-19-2004 09:46 AM
"Undeleting" data using grep, but get "grep: memory exhausted" error SammyK Linux - Software 2 03-13-2004 03:11 PM
ps -ef|grep -v root|grep apache<<result maelstrombob Linux - Newbie 1 09-24-2003 11:38 AM
grep to NOT select a word robertmarkbram Programming 2 08-21-2003 10:48 PM
How do I zip and attach the output data of a grep | awk | mail shell script? 360 Programming 1 05-08-2002 08:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:25 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
Open Source Consulting | Domain Registration