![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Searching all files that contain pattern | ravi.sadani19 | Shell Programming and Scripting | 4 | 11-29-2008 06:52 PM |
| Searching for files with certain string pattern | intrigue | UNIX for Dummies Questions & Answers | 1 | 02-28-2008 05:28 PM |
| Regarding Searching Pattern | sbasetty | Shell Programming and Scripting | 2 | 09-29-2006 05:49 PM |
| Pattern searching inside Variable - not looking at files | Rediranch | UNIX for Dummies Questions & Answers | 3 | 06-07-2005 02:07 PM |
| pattern searching using C | giannicello | High Level Programming | 1 | 04-16-2002 12:53 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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 |
|
||||
|
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 09: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 |
| Sponsored Links | ||
|
|