Grabbing lines out of a file based on a date

Hello,

I'm new to this forum and am not exactly sure where to post this question, so I'll start here. I'm looking for a command or simple script that will read in a large flat file (contains 2005 data) and will output a new file based on a quarter. Within each row, position 87-90 is a julian date with values 5001 thru 5365. If I want 4th quarter data, all rows with a date of 5274 thru 5365 should be written into a new file. What's the easiest way to accomplish this?

Thanks,
Brian

awk '{
        qtr=substr($0,87,4);
        if(qtr > 5273 && qtr < 5366 ){ print $0 }
      }'  mylargefile  >  fourth_quarterfile 

try something like that

Thanks! It worked perfectly.