|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
typedef struct example_struct_name{ int i; char j; ... ... ... ... } EXAMPLE_STRUCT_NAME; I need to search al such structs based on three strings : (1) typedef , (2) struct , (3) EXAMPLE_STRUCT_NAME I atleast want to know all the files in the project which contain such structs. can anyone me with how to find such file using grep ?? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Wed, 18 Jul 2007 04:55:21 -0700, onkar
<onkar.n.m@gmail.com> wrote: > > > > > typedef struct example_struct_name{ > int i; > char j; > ... > ... > ... > ... > } EXAMPLE_STRUCT_NAME; > > > I need to search al such structs based on three strings : (1) > typedef , (2) struct , (3) EXAMPLE_STRUCT_NAME > > I atleast want to know all the files in the project which contain > such structs. > > can anyone me with how to find such file using grep ?? > grep -l -E 'typedef|struct|EXAMPLE_STRUCT_NAME' -- Like the ski resort of girls looking for husbands and husbands looking for girls, the situation is not as symmetrical as it might seem. -- Alan McKay |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Wed, 18 Jul 2007 04:55:21 -0700, onkar
<onkar.n.m@gmail.com> wrote: > > > > > typedef struct example_struct_name{ > int i; > char j; > ... > ... > ... > ... > } EXAMPLE_STRUCT_NAME; > > > I need to search al such structs based on three strings : (1) > typedef , (2) struct , (3) EXAMPLE_STRUCT_NAME > > I atleast want to know all the files in the project which contain > such structs. > > can anyone me with how to find such file using grep ?? > grep -l -E 'typedef|struct|EXAMPLE_STRUCT_NAME' -- Like the ski resort of girls looking for husbands and husbands looking for girls, the situation is not as symmetrical as it might seem. -- Alan McKay |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
onkar wrote:
> > typedef struct example_struct_name{ > int i; > char j; > ... > ... > ... > ... > } EXAMPLE_STRUCT_NAME; > > > I need to search al such structs based on three strings : (1) > typedef , (2) struct , (3) EXAMPLE_STRUCT_NAME > > I atleast want to know all the files in the project which contain > such structs. > > can anyone me with how to find such file using grep ?? > You can't. You need to use a tool that understands the language otherwise you'll get false matches on things like: typedef enum bob { a, b, /* will name a struct */ ... } BOB; or various other combinations. You can quite a bit by stripping out comments with a preprocessor (e.g. gcc -E) but I still don't believe you can resolve all the issues. If you're examining C files and looking for structure definitions, take a look at cscope (http://cscope.sourceforge.net/). Ed. |
|
![]() |
| Outils de la discussion | |
|
|