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

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

Re: [shell-script] Busca 2a. linha anterior string


From: Aurelio Marinho Jargas
Subject: Re: [shell-script] Busca 2a. linha anterior string
Date: Tue, 23 Nov 2004 14:09:54 -0300 (ART)

oi andré,

 --- André Luiz Alves da Silva Prates escreveu: 
> Preciso de uma maneira buscar o
> conteúdo da segunda linha anterior a string informada.  
> E como acrescento a linha que ocorre a string inclusive? Exemplo:
>  
> $ seq 10 | sed -n '/8/{algo;p;}'
> 6
> 8

se colocar um grep antes do sed fica fácil ;)

  $ seq 10 | grep -B2 8 | sed 2d
  6
  8

falou!


=====
-- 
Aurelio Marinho Jargas, Curitiba, Conectiva
Funcoes ZZ v4.1111 http://aurelio.net/zz
txt2tags v2.1 http://txt2tags.sf.net/pt


        
        
                
_______________________________________________________ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! 
http://br.acesso.yahoo.com/


reply via email to

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