Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Excluding words with more than three a

by wog (Curate)
on Dec 20, 2001 at 06:05 UTC ( #133374=note: print w/ replies, xml ) Need Help??


in reply to Excluding words with more than three a

perl -ne'y/a//>3|y/b//>2|y/k//>2||print' file # 12345678901234567890123456789012345 # 1 2 3


Comment on Re: Excluding words with more than three a
Download Code
Re: Re: Excluding words with more than three a
by Anonymous Monk on Dec 20, 2001 at 19:59 UTC
    Thank you, wog, I was looking for code similar as your approach, but I failed to find any suitable solution. I've tweaked and wrapped the code a bit, just to run it under MacPerl.
    #!perl -w use strict; my $tmpdir = 'Disco:Carpeta_Idioma:'; my $file = "$tmpdir" . 'diccionario'; my $file_out = "$tmpdir" . 'diccionario2'; open(IN, "<$file") || die "Can't open $file: $!\n"; open(OUT, ">$file_out") || die "Can't open $file_out: $!\n"; while (<IN>) { print OUT unless ( y/a//>3 | y/b//>1 | y/c//>1 | y/d//>2 | y/e//>8 | y/g//>1 | y/i//>3 | y/j//>1 | y/l//>2 | y/m//>3 | y/n//>3 | y/o//>4 | y/r//>3 | y/s//>6 | y/t//>1 | y/u//>2 | y/v//>2 ) } close IN; close OUT;
    The code snippet looked nice indented on my Mac. Hope it looks fine here too. Best regards, Richard

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://133374]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-08-23 21:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (178 votes), past polls