LinuxQuestions.org
Help answer threads with 0 replies.
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 06-13-2003, 04:20 AM   #1
specialist01
LQ Newbie
 
Registered: Jun 2003
Posts: 4

Rep: Reputation: 0
Grep Usage


Hello.
I have a question of how to use the grep command.

I want to search all *.c files for the string goto, but I don't want it to show the gotos which are in comments ( /* */).
After the /* and before the */ maybe other characters and also new lines.

How do I have to type the command to get the matches mentioned above

Thanks for your help.
 
Old 06-13-2003, 07:22 AM   #2
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
have you tried 'man grep' ?

(to start with)
 
Old 06-13-2003, 07:52 AM   #3
slightcrazed
Member
 
Registered: May 2003
Location: Lisbon Falls, Maine
Distribution: RH 8.0, 9.0, FC2 - 4, Slack 9.0 - 10.2, Knoppix 3.4 - 4.0, LFS,
Posts: 789

Rep: Reputation: 30
This provides an OK explanation of the grep command, and may be enough to point you in the right direction.

Just to give you some direction. You can pipe grep to itself, so if you grep for the word goto, and you want to eliminate any of the lines that have /* in them, then you can grep again with the -v option which will exclude any of the lines with that set of characters.



slight
 
  


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
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 08:43 PM
grep usage with regular expression jonathanztaub Linux - General 7 09-01-2004 10:35 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM
Controlling CPU usage & memory usage Saravana babu Linux - Software 0 02-18-2004 05:55 AM
ps -ef|grep -v root|grep apache<<result maelstrombob Linux - Newbie 1 09-24-2003 11:38 AM


All times are GMT -5. The time now is 03:54 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration