Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: In-place file filtering

by dragonchild (Archbishop)
on Jul 24, 2003 at 19:35 UTC ( [id://277667]=note: print w/replies, xml ) Need Help??


in reply to In-place file filtering

warn "*$zip*"; next unless
should be (note ; => ,)
warn "*$zip*", next unless
Also, you're not printing the good value back out. I would do something like:
perl -pi.bak -e 'chomp;my($x,$y)=split/\t/;do{warn"*$y*\n";next}unless +$y=~/^\d{5}$/&&$y>713&&$y<99930;print"$x\t$y\n"' *.dat
Note: This code is lighly tested! YMMV

Update: Heh - really lightly tested. My code works if you change -p to -n. Ignore me. :-)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-28 11:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found