LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Grep Usage (http://www.linuxquestions.org/questions/linux-general-1/grep-usage-65355/)

specialist01 06-13-2003 05:20 AM

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.

tcaptain 06-13-2003 08:22 AM

have you tried 'man grep' ?

(to start with)

slightcrazed 06-13-2003 08:52 AM

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


All times are GMT -5. The time now is 05:12 AM.