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

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

Re: [shell-script] Inserir string no inicio da linha


From: Andreyev Dia de Melo
Subject: Re: [shell-script] Inserir string no inicio da linha
Date: Tue, 10 Sep 2002 16:11:45 -0300
User-agent: Mutt/1.3.17i

Hi!

Acho q isso jah foi sugerido, mas nao dessa forma...
Se vc for procurar por uma expressao regular no texto em questao, pode usar:

cat <arquivo> | sed -e '`grep -n <string> <arquivo> | cut -f 1 -d :` s/^/novo 
texto/' >arquivo_novo.txt
Caso queira alterar apenas a primeira ocorrencia...

tac <arquivo> | sed -e '`grep -n <string> <arquivo> | cut -f 1 -d :` s/^/novo 
texto/' >arquivo_novo.txt
Caso queria alterar apenas a ultima ocorrencia

Acho q eh isso!
[]s
-- 
--------------------------------------
Andreyev Dias de Melo
CPqD Telecom  & IT Solutions
Gerência de Infraestrutura e Produção
Fone.: + 55 19 3705-6917
Fax  : + 55 19 3705-6113
Cel. : + 55 19 9116-4539
e-mail: address@hidden 
http://www.cpqd.com.br 


reply via email to

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