[FUG-BR] grep

Ricardo A. Reis ricardo_bsd em yahoo.com.br
Dom Abr 10 09:03:03 BRT 2005


Celso,

   O grep e' pobre de regexp mais isso ele faz hehe

man grep
------
   -e pattern_list Specifies one or more patterns  to  be  used
                     during  the  search  for  input. Patterns in
                     pattern_list must be separated by a  NEWLINE
                     character.  A  null pattern can be specified
                     by  two  adjacent  newline   characters   in
                     pattern_list.  Unless the -E or -F option is
                     also specified, each pattern is treated as a
                     basic  regular  expression.  Multiple -e and
                     -f options are accepted by grep. All of  the
                     specified  patterns  are  used when matching
                     lines,  but  the  order  of  evaluation   is
                     unspecified.
---------

Ex.

grep -e ricardo -e root /etc/passwd
root:x:0:0:Super-User:/:/bin/ksh
ricardo:x:100:100:Ricardo A. Reis:/export/home/ricardo:/usr/bin/bash

   Atenciosamente
   Ricardo A. Reis
   UNIFESP - SENAI
   Unix and System Admin


>>como é que faria para o "grep" me retornar as ocorrências de "maria",
>>"jose", "teste", etc  .... tudo numa só linha...
>>
>>Celso
>>
>>    
>>
>Olá Celso,
>
>    Tenta isto:
>
>    $ egrep '(maria|jose|teste)' arquivo
>
>    Exemplo:
>
>    $ egrep '(root|fredcox)' /etc/passwd
>
>  
>




_______________________________________________
Freebsd mailing list
Freebsd em fug.com.br
http://mail.fug.com.br/mailman/listinfo/freebsd_fug.com.br




Mais detalhes sobre a lista de discussão freebsd