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

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

Re: [shell-script] Comando sed


From: Ernander (Nander)
Subject: Re: [shell-script] Comando sed
Date: Thu, 4 Jun 2009 10:11:02 -0300

nander@estacao11:~$ cat arquivo

Sun Nov 23 06:32:10 2007 1055 xxx.xxx.xxx.xxx. TCP_MISS/200 198395 GET
http://www.uol.com.br - DIRECT/200.221.2.45 text/html
Sun Nov 23 06:32:10 2007 1055 xxx.xxx.xxx.xxx. TCP_MISS/200 198395 GET
http://www.uol.com.br - DIRECT/200.221.2.45 text/html
Sun Nov 23 06:37:10 2008 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154 GET
http://www.uol.com.br - DIRECT/200.98.249.120 text/html
Sun Nov 23 06:37:10 2009 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154 GET
http://www.uol.com.br - DIRECT/200.98.249.120 text/html
Sun Nov 23 06:37:10 2008 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154 GET
http://www.uol.com.br - DIRECT/200.98.249.120 text/html


nander@estacao11:~$ sed '/2008/d' arquivo
Sun Nov 23 06:32:10 2007 1055 xxx.xxx.xxx.xxx. TCP_MISS/200 198395 GET
http://www.uol.com.br - DIRECT/200.221.2.45 text/html
Sun Nov 23 06:32:10 2007 1055 xxx.xxx.xxx.xxx. TCP_MISS/200 198395 GET
http://www.uol.com.br - DIRECT/200.221.2.45 text/html
Sun Nov 23 06:37:10 2009 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154 GET
http://www.uol.com.br - DIRECT/200.98.249.120 text/html

Veja se é isso, por que no Link do Thobias  tem uns exemplos até mais
intuitivos.


Att

Ernander


2009/6/3 Anderson Nascimento <address@hidden>

>
>
> Opa cara,
> Obrigado pelo feedback. Não devo ter me expressado bem. Mais queria remover
> as ocorrências. Tipo, na linha que contem o acesso em 2008, eu apagar tudo
> que tiver em 2008, as linhas.
>
>
> 2009/6/3 Flavio Torres <address@hidden<fla_torres%40yahoo.com.br>
> >
>
> >
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> >
> > Anderson Nascimento wrote:
> > > Lista,
> > >
> > > Estou batendo a cabeça para remover determinadas linhas de um arquivo.
> > >
> > > Seguinte.
> > >
> > > tenho um arquivo que tem o seguinte conteudo.
> > >
> > > Sun Nov 23 06:32:10 2008 1055 xxx.xxx.xxx.xxx. TCP_MISS/200 198395 GET
> > > http://www.uol.com.br - DIRECT/200.221.2.45 text/html
> > > Sun Nov 23 06:37:10 2008 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154 GET
> > > http://www.uol.com.br - DIRECT/200.98.249.120 text/html
> > >
> > >
> > > Então queria pegar apagar todas as ocorrencias de 2008 por exemplo
> desse
> > > arquivo.
> > >
> > >
> > > Li o man de sed mais não rolou nada.
> >
> > hmmm....Leu mesmo?
> >
> > debian:~# cat arq.txt
> > Sun Nov 23 06:32:10 2008 1055 xxx.xxx.xxx.xxx. TCP_MISS/200 198395
> > GET http://www.uol.com.br - DIRECT/200.221.2.45 text/html
> > Sun Nov 23 06:37:10 2019 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154
> > GET http://www.uol.com.br - DIRECT/200.98.249.120 text/html
> > Sun Nov 23 06:37:10 2008 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154
> > GET http://www.uol.com.br - DIRECT/200.98.249.120 text/html
> > Sun Nov 23 06:37:10 2009 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154
> > GET http://www.uol.com.br - DIRECT/200.98.249.120 text/html
> > Sun Nov 23 06:37:10 2009 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154
> > GET http://www.uol.com.br - DIRECT/200.98.249.120 text/html
> >
> > debian:~# sed '/2008/d' arq.txt
> > Sun Nov 23 06:37:10 2019 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154
> > GET http://www.uol.com.br - DIRECT/200.98.249.120 text/html
> > Sun Nov 23 06:37:10 2009 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154
> > GET http://www.uol.com.br - DIRECT/200.98.249.120 text/html
> > Sun Nov 23 06:37:10 2009 1255 xxx.xxx.xxx.xxx TCP_MISS/200 198154
> > GET http://www.uol.com.br - DIRECT/200.98.249.120 text/html
> >
> > ...skipping...
> > d Delete pattern space. Start next cycle.
> >
> > []'s
> >
> > - --
> >
> > /*---------------------------------------------------*/
> > /* * Flavio Torres - Administrador de Sistemas*/
> > /* /_\ */int y,z;main(x){x=(x>0?-9:x);z=((z=(x+5)
> > /* o. .o */)>0?z:-z);printf(!x&&++y?"\n":z?z>y%3+y/
> > /* ((Y)) */3?" ":x<-5?"/":"\\":y?"|":"*");y-9?main(
> > /* ()) (() */++x):puts(" _|_|_")&&puts(" \\___/");}
> > /* ()^() A party animal isn't just for Christmas.*/
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.8 (MingW32)
> >
> > iEYEARECAAYFAkonMNkACgkQNRQApncg29712ACg7fIzszFqDm9+ikuFfgSvb/5O
> > x6oAoN8+QuoKnkC4vqGluE+EFp3+7tht
> > =ytaB
> > -----END PGP SIGNATURE-----
> >
> >
> >
>
> --
> Anderson Raimundo
> Analista de Suporte
> +55 (71) 8178-5378
>
> [As partes desta mensagem que não continham texto foram removidas]
>
>  
>



-- 
╔═══════════════════╗
║ Ernander Lataliza ║
╚═══════════════════╝
--------------------------------------
SEJA LIVRE! USE LINUX!
Linux User #394812
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.6 (GNU/Linux)

mQGiBEnrmpwRBADsGwMo8R2spUxfer19bGyX5mAXRyEhm5vlzkOH9T7Fe4WyAvLM
rDpSKjv1VgcC3/fSMpPQ8MmQZwwO4H87IIwyN0AX/NqvmEQDNMVZS6omrcN39jpt
xEC80Hs/TP/yKyB2V6seHV0eZtjlfmokIb7nYazcxTLAhiv9CVg9nL+JCwCg+gNL
R+1rQcqGooGtjIL95OZr/8kEANpGy/Jb+B7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


[As partes desta mensagem que não continham texto foram removidas]



reply via email to

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