![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Searching for files with certain string pattern | intrigue | UNIX for Dummies Questions & Answers | 1 | 02-28-2008 01:28 PM |
| Regarding Searching Pattern | sbasetty | Shell Programming and Scripting | 2 | 09-29-2006 02:49 PM |
| Searching all files that contain pattern | ravi.sadani19 | Shell Programming and Scripting | 3 | 01-26-2006 08:43 AM |
| Pattern searching inside Variable - not looking at files | Rediranch | UNIX for Dummies Questions & Answers | 3 | 06-07-2005 11:07 AM |
| pattern searching using C | giannicello | High Level Programming | 1 | 04-16-2002 09:53 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Pattern searching pattern in c files
I have a problem in searching a specific pattern in c files.
My requirement: I have to find all the division operator in all cfiles. The problem is, the multi line comments and single line comments will also have forward slash in it. Even after avoiding these comments also, if both the division operator and the comments come in the same line, we are missing the division operator. Please provide me the solution... Give me some suggestions |
| Forum Sponsor | ||
|
|
|
|||
|
The -n option suppresses the automatic output of input lines (that's the default).
The p at the end tells sed to output the lines that matches. Code:
[0-9a-zA-Z] * The characters within the brackets search for a numeric character or a variable and the space and asteric after the brackets for zero or more spaces. Code:
\/ Code:
*[0-9a-zA-Z]* Regards Last edited by Franklin52; 11-17-2007 at 05:50 AM. Reason: typo |
|
|||
|
Pattern searching pattern in c files
Thank you very much.
This solution is giving all the files which is having division operator. And at the same time giving some files which dont have division operator. xx.c : x=y; /*** dfldkfdk **/ xx.c : return; /** dfkdfdkd **/ xx.c : /** return some value **/ can you give me any suggestion on this?? thanks & regards, murthy. |
|
|||
|
I placed those lines in a file and it works fine for me, I don't get those lines as output.
Have you typed the command exactly? Note the spaces before the asterics. If you forgot them you didn't understand my explanation above. Regards |
|||
| Google The UNIX and Linux Forums |