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

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

Re: [shell-script] Substituição de palavra


From: M. Rodrigo Monteiro
Subject: Re: [shell-script] Substituição de palavra
Date: Thu, 27 Feb 2014 10:52:55 -0300

Exatamente isso!
Pode explicar este sed?

M. Rodrigo Monteiro
    
"Free as in Freedom, not free as in free beer"
"As we are liberated from our own fear, our presence automatically liberates others"
Linux User # 403730

Pense antes de imprimir. Think before printing.

AVISO LEGAL
Esta mensagem é destinada exclusivamente para a(s) pessoa(s) a quem é dirigida, podendo conter informação confidencial e/ou legalmente privilegiada. Se você não for destinatário desta mensagem, desde já fica notificado de abster-se a divulgar, copiar, distribuir, examinar ou, de qualquer forma, utilizar a informação contida nesta mensagem, por ser ilegal. Caso você tenha recebido esta mensagem por engano, pedimos que nos retorne este E-Mail, promovendo, desde logo, a eliminação do seu conteúdo em sua base de dados, registros ou sistema de controle. Fica desprovida de eficácia e validade a mensagem que contiver vínculos obrigacionais, expedida por quem não detenha poderes de representação.

LEGAL ADVICE
This message is exclusively destined for the people to whom it is directed, and it can bear private and/or legally exceptional information. If you are not addressee of this message, since now you are advised to not release, copy, distribute, check or, otherwise, use the information contained in this message, because it is illegal. If you received this message by mistake, we ask you to return this email, making possible, as soon as possible, the elimination of its contents of your database, registrations or controls system. The message that bears any mandatory links, issued by someone who has no representation powers, shall be null or void.



Em 27 de fevereiro de 2014 10:47, Tiago Peczenyj <address@hidden> escreveu:
 

Algo assim?

$ echo -e "dominio\tnumero\tIN SOA\tregistro email numero numero numero numero" > file
$ sed 's/\(IN SOA\s\)[^ ]*/\1REGISTRO_NOVO/g' file
dominio numero IN SOA REGISTRO_NOVO email numero numero numero numero



2014-02-27 10:39 GMT-03:00 M. Rodrigo Monteiro <address@hidden>:

 

Acho que não expliquei correto...
Quero mudar a string após a string SOA. São várias strings diferentes... quero mudar todas para uma única string.

Ex.:
vicultura.com.br.                             43200 IN SOA      ns1.granlink.com.br. root.vicultura.com.br. 2007051703 3600 900 1209600 43200
voolivreceara.com.br.                         86400 IN SOA      voolivreceara.com.br. root.voolivreceara.com.br. 200112171 3600 900 900000 86400
infosecurity.eti.br.                          86400 IN SOA      infosecurity.eti.br. root.infosecurity.eti.br. 200112171 3600 900 900000 86400
espindola.imb.br.                             43200 IN SOA      ns1.espindola.imb.br. root.espindola.imb.br. 2008091101 3600 900 1209600 43200


M. Rodrigo Monteiro
    
"Free as in Freedom, not free as in free beer"
"As we are liberated from our own fear, our presence automatically liberates others"
Linux User # 403730

Pense antes de imprimir. Think before printing.

AVISO LEGAL
Esta mensagem é destinada exclusivamente para a(s) pessoa(s) a quem é dirigida, podendo conter informação confidencial e/ou legalmente privilegiada. Se você não for destinatário desta mensagem, desde já fica notificado de abster-se a divulgar, copiar, distribuir, examinar ou, de qualquer forma, utilizar a informação contida nesta mensagem, por ser ilegal. Caso você tenha recebido esta mensagem por engano, pedimos que nos retorne este E-Mail, promovendo, desde logo, a eliminação do seu conteúdo em sua base de dados, registros ou sistema de controle. Fica desprovida de eficácia e validade a mensagem que contiver vínculos obrigacionais, expedida por quem não detenha poderes de representação.

LEGAL ADVICE
This message is exclusively destined for the people to whom it is directed, and it can bear private and/or legally exceptional information. If you are not addressee of this message, since now you are advised to not release, copy, distribute, check or, otherwise, use the information contained in this message, because it is illegal. If you received this message by mistake, we ask you to return this email, making possible, as soon as possible, the elimination of its contents of your database, registrations or controls system. The message that bears any mandatory links, issued by someone who has no representation powers, shall be null or void.



Em 27 de fevereiro de 2014 10:17, Tiago Peczenyj <address@hidden> escreveu:
 

use sed s/registro/registroNovo/g se vc nao tem nenhuma outra ocorrencia da string 'registro' no seu arquivo.

se tiver vamos ter que fazer algo mais elaborado.


2014-02-27 9:04 GMT-03:00 M. Rodrigo Monteiro <address@hidden>:

 

Caros, bom dia!

Estou fazendo uma manutenção em um DNS, e nele o padrão é o seguinte:

dominio TAB numero TAB IN SOA TAB registro email numero numero numero numero

Eu queria alterar em todas as linhas o segundo registro. Ou seja, que fique assim:

dominio TAB numero TAB IN SOA TAB registroNOVO email numero numero numero numero


Um exemplo real
brazilmarket.net.                             86400 IN SOA      brazilmarket.net. root.brazilmarket.net. 2000041302 3600 900 900000 86400

M. Rodrigo Monteiro
    
"Free as in Freedom, not free as in free beer"
"As we are liberated from our own fear, our presence automatically liberates others"
Linux User # 403730

Pense antes de imprimir. Think before printing.

AVISO LEGAL
Esta mensagem é destinada exclusivamente para a(s) pessoa(s) a quem é dirigida, podendo conter informação confidencial e/ou legalmente privilegiada. Se você não for destinatário desta mensagem, desde já fica notificado de abster-se a divulgar, copiar, distribuir, examinar ou, de qualquer forma, utilizar a informação contida nesta mensagem, por ser ilegal. Caso você tenha recebido esta mensagem por engano, pedimos que nos retorne este E-Mail, promovendo, desde logo, a eliminação do seu conteúdo em sua base de dados, registros ou sistema de controle. Fica desprovida de eficácia e validade a mensagem que contiver vínculos obrigacionais, expedida por quem não detenha poderes de representação.

LEGAL ADVICE
This message is exclusively destined for the people to whom it is directed, and it can bear private and/or legally exceptional information. If you are not addressee of this message, since now you are advised to not release, copy, distribute, check or, otherwise, use the information contained in this message, because it is illegal. If you received this message by mistake, we ask you to return this email, making possible, as soon as possible, the elimination of its contents of your database, registrations or controls system. The message that bears any mandatory links, issued by someone who has no representation powers, shall be null or void.




--
Tiago B. Peczenyj
Linux User #405772

http://about.me/peczenyj





--
Tiago B. Peczenyj
Linux User #405772

http://about.me/peczenyj



reply via email to

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