-   Linux - General (
-   -   Grep Usage (

specialist01 06-13-2003 04:20 AM

Grep Usage
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 07:22 AM

have you tried 'man grep' ?

(to start with)

slightcrazed 06-13-2003 07: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.



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