Ezra, thanks beforehands for your help. but i'm searching that type of word :
#!/usr/bin/perl -w open(FILE, "altoc1.res") or die "Can't open : $!\n"; $count=0; while(<FILE>) { chomp; if (m/<NONE>/) #or <NONE/> , <"any word"> , </"any Word> like XML { $count++; } #end of if statement } #end of while loop print "The count for NONE is $count\n"; close FILE; Could you herlp me again ? thanks!!! Gonzalo Gómez -----Mensaje original----- De: Ezra Taylor [mailto:[EMAIL PROTECTED] Enviado el: Lunes, 07 de Febrero de 2005 11:19 a.m. Para: Gomez, Gonzalo CC: beginners@perl.org Asunto: Re: Filter Regular Expressions Gomez, Gonzalo wrote: >Hi, I want to filter text using regular expressions, but i don't know how to >find in a file a string like this <NONE> , or <NONE/> , or </bsvgId> , Etc. I >try to use the little script bellow with a count for the word but this scrit >doesn't work if i put symbols like / , \ , > , < (Reserved Symbols). > >Anyone can help me ? Thanks. > >Begin Script ........................ > >#!/usr/bin/perl >$count=0; >while (<>) >{ >$count += s/\bNONE\b//g; >} >print "$count\n"; > >End Litle Script .................... > >Este mensaje (incluyendo cualquier anexo) contiene información confidencial >que se encuentra protegida por la Ley. La información que contiene, sólo puede >ser utilizada por la persona o compañía a la cual está dirigido. Si usted no >es un receptor autorizado, o por error recibe el mensaje, omita su contenido y >elimínelo inmediatamente. Cualquier retención, difusión, distribución y/o >copia así como la ejecución de cualquier acción basado en el contenido del >mismo, se encuentra estrictamente prohibido, y esta amparado por la ley. > >-------------- > >This message (including any attachments) contains confidential information >intented for a specific individual and purpose, and is protected by law. If >you are not the intented recipient, you should delete this message. Any >disclosure, copying, or distribution of this message, or the taking of any >action based on it, is strictly prohibited. > > > Gomez: A possible solution for this could be: #!/usr/bin/perl -w open(FILE, "test") or die "Can't open : $!\n"; $count=0; while(<FILE>) { chomp; if (m/NONE/) { $count++; } #end of if statement } #end of while loop print "The count for NONE is $count\n"; close FILE; Este mensaje (incluyendo cualquier anexo) contiene información confidencial que se encuentra protegida por la Ley. La información que contiene, sólo puede ser utilizada por la persona o compañía a la cual está dirigido. Si usted no es un receptor autorizado, o por error recibe el mensaje, omita su contenido y elimínelo inmediatamente. Cualquier retención, difusión, distribución y/o copia así como la ejecución de cualquier acción basado en el contenido del mismo, se encuentra estrictamente prohibido, y esta amparado por la ley. -------------- This message (including any attachments) contains confidential information intented for a specific individual and purpose, and is protected by law. If you are not the intented recipient, you should delete this message. Any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>