Reputation: 2890
I've been working on this for a while, but got no solution. The problem is I have multiple lines of addresses like the following:
Enright Ave 98213 62330 Saint Louis Missouri 314-544-0921
I've considered to break the line by empty space to match the five consecutive number as the zip code (62330), but this does not work since sometimes the address has such label (98213) in it, can anybody provide some suggestions on it? thanks
Upvotes: 0
Views: 863
Reputation: 119
Try this:
ack yourfile.txt -o --match '[0-9]{5}(?!.*([0-9]{5}))'
What this does is find the last 5 digit number on each line
Upvotes: 1