shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shell-script] "grep" que retorne somente a string procurada


From: Programming Database
Subject: Re: [shell-script] "grep" que retorne somente a string procurada
Date: Mon, 27 Nov 2006 17:00:32 -0200

Boa tarde,

Espero que ajude:

Conteúdo do arquivo sed.out:
isso aqui eh um teste. teste1={MMM} teste2={KKK}
isso aqui eh um teste. teste3={MMM} teste4={KKK}
isso aqui eh um teste. teste5={MMM} teste6={KKK}

Resultado:
$~>grep -oE "[^ ]*KKK." sed.out
teste2={KKK}
teste4={KKK}
teste6={KKK}
$~>grep -oE "[^ ]*MMM." sed.out
teste1={MMM}
teste3={MMM}
teste5={MMM}
$~>

[]´s
Vanderlei

2006/11/27, Tiago Barcellos Peczenyj <address@hidden>:
>
>   tente a opção -o
>
> echo "lalala" | grep -o -E 'expressão regular'
>
> On 11/27/06, Rodrigo Monteiro <address@hidden <mrodrigox%40gmail.com>>
> wrote:
> >
> > Bom dia!
> >
> > Gostaria de saber se existe algum comando que faça o seguinte:
> >
> > # echo "isso aqui eh um teste. teste1={MMM} teste2={KKK}" | comando
> "MMM"
> > teste1={MMM}
> > # echo "isso aqui eh um teste. teste1={MMM} teste2={KKK}" | comando "KK"
> > teste2={KKK}
> >
> > Ou seja, um grep que não me retorne a linha toda, mas sim somente a
> > string que se encaixe no padrão procurado.
> > Ajudas?
> >
> > []s
> >
> > --
> > Rodrigo Monteiro
> > "Free as in Freedom, not free as in free beer"
> > Linux User # 403730
> > JID: address@hidden <mrodrigom%40jabber.org><mrodrigom%40jabber.org>
> > address@hidden <mrodrigox%40gmail.com> <mrodrigox%40gmail.com>
> >
> >
>
> --
> Tiago B Peczenyj
> Linux User #405772
>
> # cd /pub
> # more beer
>
> [As partes desta mensagem que não continham texto foram removidas]
>
>  
>



-- 
by Programming Database


[As partes desta mensagem que não continham texto foram removidas]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]