PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > grep - please !!
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

grep - please !!

Réponse
 
LinkBack Outils de la discussion
Vieux 18/07/2007, 12h55   #1
onkar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut grep - please !!



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 ??

  Réponse avec citation
Vieux 18/07/2007, 14h04   #2
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: grep - please !!

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
  Réponse avec citation
Vieux 18/07/2007, 14h04   #3
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: grep - please !!

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
  Réponse avec citation
Vieux 18/07/2007, 15h15   #4
Ed Morton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: grep - please !!

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.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h31.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12071 seconds with 12 queries