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

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

Re: [shell-script] acrescentar palavra na linha após a string


From: Fábio Batista
Subject: Re: [shell-script] acrescentar palavra na linha após a string
Date: Mon, 13 Jun 2005 19:26:01 -0300

[fabio@elefante testes]$ cat delete.txt
DELETE:HLRSUB:MSISDN,1234;
Enter command: RESP:0;
Enter command: RESP:0;
Enter command: RESP:14;
DELETE:HLRSUB:MSISDN,4567;
Enter command: RESP:0;
Enter command: RESP:14;
Enter command: RESP:14;

[fabio@elefante testes]$ cat delete.txt | sed -r '/^DELETE/ {n;s/.*/TESTE &/}'
DELETE:HLRSUB:MSISDN,1234;
TESTE Enter command: RESP:0;
Enter command: RESP:0;
Enter command: RESP:14;
DELETE:HLRSUB:MSISDN,4567;
TESTE Enter command: RESP:0;
Enter command: RESP:14;
Enter command: RESP:14;

-- 
Fábio David Batista
address@hidden
http://nerd-o-matic.blogspot.com


On 6/13/05, André Luiz Alves da Silva Prates <address@hidden> wrote:
>  Caros colegas,
>  
>  
>  
>  Mais uma vez preciso da ajuda de vcs. 
>  
>  Estou precisando acrescentar uma palavra no início da linha posterior a
> linha que eu encontrar a string "DELETE"
>  
>  
>  
>  
>  
>  Arquivo fonte:
>  
>  DELETE:HLRSUB:MSISDN,1234;
>  
>  Enter command: RESP:0;
>  
>  Enter command: RESP:0;
>  
>  Enter command: RESP:14;
>  
>  DELETE:HLRSUB:MSISDN,4567;
>  
>  Enter command: RESP:0;
>  
>  Enter command: RESP:14;
>  
>  Enter command: RESP:14;
>  
>  DELETE:HLRSUB:MSISDN,6783;
>  
>  Enter command: RESP:0;
>  
>  Enter command: RESP:0;
>  
>  Enter command: RESP:14;
>  
>  
>  
>  
>  
>  Resultado desejado(acrescentado a palavra TESTE)
>  
>  
>  
>  DELETE:HLRSUB:MSISDN,1234;
>  
>  TESTE Enter command: RESP:0;
>  
>  Enter command: RESP:0;
>  
>  Enter command: RESP:14;
>  
>  DELETE:HLRSUB:MSISDN,4567;
>  
>  TESTE Enter command: RESP:0;
>  
>  Enter command: RESP:14;
>  
>  Enter command: RESP:14;
>  
>  DELETE:HLRSUB:MSISDN,6783;
>  
>  TESTE Enter command: RESP:0;
>  
>  Enter command: RESP:0;
>  
>  Enter command: RESP:14;
>  
>  
>  
>  
>  
>  Valeu!
>  
>  
>  
>  
>  
>  André Prates
>  
>  IT Operations & Support - Sales
>  
>  *address@hidden
> <mailto:*address@hidden>


reply via email to

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