[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] "grep" que retorne somente a string procurada
From: |
Eric Anderson |
Subject: |
Re: [shell-script] "grep" que retorne somente a string procurada |
Date: |
Mon, 27 Nov 2006 14:35:14 -0200 |
a opção -o do grep faz isso:
groo@cacic:~$ echo "isso aqui eh um teste. teste1={MMM} teste2={KKK}" | grep -o
"MMM"
MMM
groo@cacic:~$ echo "isso aqui eh um teste. teste1={MMM} teste2={KKK}" | grep
"MMM"
isso aqui eh um teste. teste1={MMM} teste2={KKK}
groo@cacic:~$
sds
Eric
----- Original Message -----
From: Rodrigo Monteiro
To: Lista Shell-script
Sent: Monday, November 27, 2006 2:19 PM
Subject: [shell-script] "grep" que retorne somente a string procurada
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
address@hidden
[As partes desta mensagem que não continham texto foram removidas]
Re: [shell-script] "grep" que retorne somente a string procurada,
Eric Anderson <=
Re: [shell-script] "grep" que retorne somente a string procurada, Tiago Barcellos Peczenyj, 2006/11/27