zip code filter problem using AWK need help

Hello all;

I have a large file (csv file) with addresses. I am trying to filter out specific entries based on zip code from a particular column of data. However my awk statement can not account for zipcode that begins with a certain pattern. It finds the pattern anywhere within the zipcode. Zipcodes have been entered either using the 5 digit method or 9 digit method (no hypen). I have tried the ^ option but it does not seem to work.

Here is my example that works but needs editing:

awk -F"," '($25 ~ /[1][2][3][0-9][0-9]/)' infile > outfile

have tried

awk -F"," '($25 ~ /^[1][2][3][0-9][0-9]/)' infile > outfile ' doesn't work

Any suggestions would be greatly appreciated.

nelson

What exactly are you trying to exclude or include?

thanks for replying

Some entries for the zipcodes are 5 digit and some are 9 digit.
Im trying to find all zipcodes that are within a certain range that begin with a specificed range. ie 1234(0-9). My problem is that my current awk syntax does find my zips, however it can find that particular sequence anywhere within the a 9 digit zipcode. It find the 5 digit ones just fine. I hope that clears it up some.

nelson

show some samples of input file