[Cascavel-pm] RES: RES: RES: RES: Substituição de string e gravação no arquivo

Igor Sutton igor.sutton em gmail.com
Quinta Julho 27 10:42:52 PDT 2006


Como você executou o seu programa?

input.xml:
<project>
<release>1.1</release>
<something/>
</project>

teste.pl:
#!/usr/bin/perl

$^I = ".bak";

while(<>) {
        s/SNAPSHOT/1.1/;
        print;
}

como executar:

$ perl teste.pl input.xml

saída:

$ ls input.xml*
input.xml  input.xml.bak
$ cat input.xml
<project>
<release>1.1</release>
<something/>
</project>

Em 27/07/06, Paola Montini <PMontini em ymf.com.br> escreveu:
>
>  Desculpe Igor, mas  a sua solução não está funcionando nessa linha
>    s/SNAPSHOT/1.1/ if /SNAPSHOT/;.
>
> Att
>
>
> bPaola Montini
> YMF-Consultoria
> Fone: 5010-9220
>
> -----Mensagem original-----
> *De:* cascavel-pm-bounces+pmontini=ymf.com.br em pm.org [mailto:
> cascavel-pm-bounces+pmontini=ymf.com.br em pm.org]*Em nome de *Igor Sutton
> *Enviada em:* quinta-feira, 27 de julho de 2006 14:05
> *Para:* Cascavel Perl Mongers
> *Assunto:* Re: [Cascavel-pm]RES: RES: RES: Substituição de string e
> gravação no arquivo
>
> No exemplo que o Nelson postou ( e no meu também ) isso não acontece. Dê
> uma olhada, pois o que você precisa está lá.
>
> Em 27/07/06, Paola Montini < PMontini em ymf.com.br> escreveu:
> >
> > Meleca falei rápido demais....
> > o que esta acontecendo é que ele está colocando uma linha a mais no meu
> > arquivo vejam:
> >
> > <projeto>Amplis </projeto>
> > <artefato>ymf-utils</artefato>
> > <versao>SNAPSHOT</versao>
> > <versao>Beta2006.1.2</versao>
> >
> >
> > #!/usr/bin/perl
> > $local =" arquivoxml.xml";
> > open(ARQXML,"+<$local");
> > @texto = <ARQXML>;
> > $nome = SNAPSHOT;
> > foreach $matriz (@texto)
> >    {
> >      if ($matriz =~ /$nome/)
> >         {
> >          $matriz =~ s/$nome/Beta2006.1.2/g;
> >          print ARQXML $matriz ;
> >         }
> > }
> >
> >
> >
> > *Paola Montini
> > YMF-Consultoria
> > Fone: 5010-9220
> >
> >
> > -----Mensagem original-----
> > De: cascavel-pm-bounces+pmontini= ymf.com.br em pm.org
> > [mailto:cascavel-pm-bounces+pmontini=ymf.com.br em pm.org]Em nome de Paola
> > Montini
> > Enviada em: quinta-feira, 27 de julho de 2006 13:59
> > Para: Cascavel Perl Mongers
> > Assunto: [Cascavel-pm] RES: RES: Substituição de string e gravação no
> > arquivo
> >
> >
> > é isso nilson, o erro era esse
> >
> > *Paola Montini
> > YMF-Consultoria
> > Fone: 5010-9220
> >
> >
> > -----Mensagem original-----
> > De: cascavel-pm-bounces+pmontini=ymf.com.br em pm.org
> > [mailto:cascavel-pm-bounces+pmontini=ymf.com.br em pm.org ]Em nome de
> > Nilson
> > Santos Figueiredo Junior
> > Enviada em: quinta-feira, 27 de julho de 2006 13:55
> > Para: Cascavel Perl Mongers
> > Assunto: Re: [Cascavel-pm]RES: Substituição de string e gravação no
> > arquivo
> >
> >
> > On 7/27/06, Paola Montini <PMontini em ymf.com.br> wrote:
> > > Missing right curly or square bracket at testexml.pl line 15, at end
> > of line
> > > syntax error at testexml.pl line 15, at EOF
> >
> > Você tentou olhar se existe algum erro próximo ao final da linha 15 do
> > arquivo testexml.pl, aonde está faltando uma chave ou colchete de
> > fechamento?
> >
> > -Nilson Santos F. Jr.
> > _______________________________________________
> > Cascavel-pm mailing list
> > Cascavel-pm em pm.org
> > http://mail.pm.org/mailman/listinfo/cascavel-pm
> > _______________________________________________
> > Cascavel-pm mailing list
> > Cascavel-pm em pm.org
> > http://mail.pm.org/mailman/listinfo/cascavel-pm
> > _______________________________________________
> > Cascavel-pm mailing list
> > Cascavel-pm em pm.org
> > http://mail.pm.org/mailman/listinfo/cascavel-pm
> >
>
>
>
> --
> Igor Sutton Lopes
> t: +55 51 9627.0779
> e: igor.sutton em gmail.com
>
> _______________________________________________
> Cascavel-pm mailing list
> Cascavel-pm em pm.org
> http://mail.pm.org/mailman/listinfo/cascavel-pm
>
>


-- 
Igor Sutton Lopes
t: +55 51 9627.0779
e: igor.sutton em gmail.com
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/cascavel-pm/attachments/20060727/7933bef1/attachment-0001.html 


Mais detalhes sobre a lista de discussão Cascavel-pm