LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 12-20-2005, 09:53 AM   #1
noware
Member
 
Registered: Oct 2005
Location: Hungary
Distribution: FC6 , freeBSD
Posts: 87

Rep: Reputation: 15
Help me with grep, pls...


Hi All!

I have a problem I thought I could solve with grep.
Here it is:

I'm working on a software which creates mass of logs and I need to catch some lines.

No.1 : I need to catch every line which contains the string 'http://' OR the string 'DEBUG'

No.2 : I need to catch every line which contains the string 'ftp://' AND 'DEBUG'

So I need to use logical expressions.

Please help me whith this.

Any ideas would be appreciated.

Thanx.
 
Old 12-20-2005, 10:26 AM   #2
PenguinPwrdBox
Member
 
Registered: Oct 2003
Posts: 568

Rep: Reputation: 31
Code:
cat $FILENAME | grep -i debug
cat $FILENAME | grep "http\:\/\/"
cat $FILENAME | grep "ftp\:\/\/" | grep -i debug
 
Old 12-20-2005, 10:54 AM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
How about this
Code:
No.1 : I need to catch every line which contains the string 'http://' OR the string 'DEBUG'

grep "http://.\|DEBUG" file.txt

No.2 : I need to catch every line which contains the string 'ftp://' AND 'DEBUG'

grep "ftp://.\+DEBUG" file.txt
 
Old 12-21-2005, 02:07 AM   #4
noware
Member
 
Registered: Oct 2005
Location: Hungary
Distribution: FC6 , freeBSD
Posts: 87

Original Poster
Rep: Reputation: 15
Thank you Guys, I really appreciate...
 
  


Reply



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
grep ?? can grep us variables? DaFrEQ Linux - Software 4 09-14-2005 12:22 PM
Help pls!!! grep or tail->restart poj Linux - Software 3 11-26-2004 12:50 AM
"Undeleting" data using grep, but get "grep: memory exhausted" error SammyK Linux - Software 2 03-13-2004 03:11 PM
pls pls pls help me ! i'm tired with httpd config on fedora apache 2.0.48 AngelOfTheDamn Fedora 0 01-24-2004 05:12 PM
ps -ef|grep -v root|grep apache<<result maelstrombob Linux - Newbie 1 09-24-2003 11:38 AM

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

All times are GMT -5. The time now is 11:45 AM.

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