[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Delimitador..
From: |
Eliphas Levy Theodoro |
Subject: |
Re: [shell-script] Delimitador.. |
Date: |
Mon, 14 Jan 2002 17:44:03 -0200 (BRST) |
Tiago N. Sampaio, @ 17:17:
> Pessoal, uma vez eu vi na lista alguem que queria mostrar o conteudo de
> um arquivo separado por delimitadores tipo..
>
> cat arquivo.txt
> seila
> #-seila
> 111
> #-fim
> sss
>
> mostrar somente o que tem entre #-seila e #fim
Tá aqui:
http://groups.yahoo.com/group/shell-script/message/1612
No teu caso, vai ser algo como:
sed -n '/#-seila/,/#-fim/ { /#-\(seila\|fim\)/d; p; }' arquivo.txt
/.../,/.../ procura por #-seila; ao encontrar, segue até encontrar
#-fim (ou o fim do arquivo); nesse intervalo, faça:
/#-(seila|fim)/d - procure por #-seila ou #-fim e delete
p - imprima
Retirei os escapes (barras invertidas) dos parênteses pra ficar mais
entendível.
--
Eliphas
Anyone sending unsolicited bulk email (UBE, SPAM) to this address will
be charged a $25 handling fee plus a $5 network traffic fee per
started kilobyte. By extracting my address from this message or its
header, you agree to these terms.
Nevertheless, spammers trying to auto-extract addresses from this
message will definitely want to include address@hidden, address@hidden,
and address@hidden
- Delimitador.., Tiago N. Sampaio, 2002/01/14
- Re: [shell-script] Delimitador..,
Eliphas Levy Theodoro <=