Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: In-place file filtering

by flounder99 (Friar)
on Jul 24, 2003 at 20:28 UTC ( #277680=note: print w/replies, xml ) Need Help??


in reply to In-place file filtering

AMEN to what RMGir said. Anyway here is my stab at it.
perl -ni.bak -e '/^\d+\t(\d{5})/&&$1>713&&$1<99930?print:warn $_' *.da +t

--

flounder

Replies are listed 'Best First'.
Re: Re: In-place file filtering
by dragonchild (Archbishop) on Jul 24, 2003 at 20:40 UTC
    I'd change that to:
    /^\d+\t(\d{5})\s*\n$/&&...
    The reason being that your code will pass 072300 as a valid zip code when it's obviously not.

    Now - I just thought of this: Only Zip5 will be allowed. Zip5+4 is not possible? If it is, change that regex to:

    /^\d+\t(\d{5})(-\d{4})?\s*\n$/&&...

    ------
    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
Node Status?
node history
Node Type: note [id://277680]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2018-10-21 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (119 votes). Check out past polls.

    Notices?