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: Marcelo Loureiro
Subject: Re: [shell-script] "grep" que retorne somente a string procurada
Date: Mon, 27 Nov 2006 14:20:37 -0300

STRING="isso aqui eh um teste. teste1={MMM} teste2={KKK}"

for i in $STRING ; do
   echo $i | grep MMM
done


2006/11/27, Rodrigo Monteiro <address@hidden>:
>
>   Hummm... nao deu muito certo nao! :(
>
> # echo "isso aqui eh um teste. teste1={MMM} teste2={KKK}" | grep -o "MM"
> MM
> # echo "isso aqui eh um teste. teste1={MMM} teste2={KKK}" | grep -o "MMM"
> MMM
> #
>
> Era para retornar teste1={MMM} em ambos os casos.
> Algo de errado?
>
> []s
>
> On 11/27/06, Rodrigo Monteiro <address@hidden <mrodrigox%40gmail.com>>
> wrote:
> > Putz... e olha que eu ainda olhei o man do grep...
> > Sorry =)
> >
> > On 11/27/06, Flavio Junior <address@hidden <billpp%40gmail.com>>
> wrote:
> > >
> > >
> > > arghh
> > >
> > > flavio@dezessete:~$ grep --help | grep \\-o
> > > -b, --byte-offset print the byte offset with output lines
> > > -o, --only-matching show only the part of a line matching PATTERN
> > > -u, --unix-byte-offsets report offsets as if CRs were not there
> (MSDOS)
> > > flavio@dezessete:~$
> > >
> >
> >
> >
> > --
> > Rodrigo Monteiro
> > "Free as in Freedom, not free as in free beer"
> > Linux User # 403730
> > JID: address@hidden <mrodrigom%40jabber.org>
> > address@hidden <mrodrigox%40gmail.com>
> >
>
> --
> Rodrigo Monteiro
> "Free as in Freedom, not free as in free beer"
> Linux User # 403730
> JID: address@hidden <mrodrigom%40jabber.org>
> address@hidden <mrodrigox%40gmail.com>
> 
>


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



reply via email to

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