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

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

Re: [shell-script] Alterar linha arquivo


From: Aurelio Marinho Jargas
Subject: Re: [shell-script] Alterar linha arquivo
Date: Mon, 10 Nov 2003 17:02:38 -0300 (ART)

oi andré,

 --- André_Luiz_Alves_da_Silva_Prates <address@hidden>:

> Por favor, algum de vcs poderia dar uma dica de como eu faço para
> alterar uma linha específica de arquivo? Por exemplo:

usa o sed. primeiro procura pela linha, depois faz o s///


> GrandeSP09.txt  sul     NOK
> co09.txt        norte   ERR
> rj09.txt        star    OK
> sul09.txt       blu     NOK
> Como poderia alterar apenas a linha 3, por exemplo?
> GrandeSP09.txt  sul     NOK
> co09.txt        norte   ERR
> rj09.txt        star    NOK
> sul09.txt       blu     NOK
> ti542m08.txt    uni     NOK

pelo número da linha:

  sed '3 s/OK/NOK/' arquivo

pela string:

  sed '/rj09/ s/OK/NOK/' arquivo

falou!

=====
-- 
Aurelio Marinho Jargas - De volta para Curitiba & Conectiva
Apostila de Shell a venda http://aurelio.net/shell/apostila
Ser tosco eh... http://aurelio.net/fotos

Yahoo! Mail - 6MB, anti-spam e antivírus gratuito. Crie sua conta agora:
http://mail.yahoo.com.br


reply via email to

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