Need help with a manual task

I have an ASCII file that I receive on a monthly bases that is fixed length. I break the file into separate files based on a 5 character numerical sequence. I have 20 different sequences I have to find.

the input file looks something like this
xy-ins 2008yuthnrlsinrthsntwilgrha33260001 sslh12 0000000000000
xy-ins 2008yuthnrlsinrthsntwilgrha33270001 sslh12 0000000000000
xy-ins 2008yuthnrlsinrthsntwilgrha33277001 sslh12 0000000000000

I want to copy every line that contains that sequence in that same position to a new file retaining the same format.

I'm not looking for someone to hand me a script but would be the best way of doing this. I do prefer using bash as my shell and thinking about using awk and a some type of loop. However, I have not used awk and would consider my skillset in this arena as a "noobie"...

thanks in advance for your suggestions.

awk '{print > substr($0,35,5)}' file
> cat file295
xy-ins 2008yuthnrlsinrthsntwilgrha33260001 sslh12 0000000000000
xy-ins 2008yuthnrlsinrthsntwilgrha33270001 sslh12 0000000000000
xy-ins 2008yuthnrlsinrthsntwilgrha33277001 sslh12 0000000000000
> cat file295 | cut -c36-40 | sort -u
32600
32700
32770

This second command will give you a sorted listing of all entries at that character position. Maybe you will pipe it into the next command, or perhaps just write that output to a work file.

From that list, you want to 'grep' or 'awk' records based on those values to separate into your respective files.

Try to build on this, and respond back if stuck again.

Thanks for the idea's... got me in the right direction. So this is what I'm playing with

nawk '/33260/ == substr($0,37,5) && /33260/ == substr($0,1,5){print $0 > "file"}' 76138.txt

bailing out at source line 1 is the error I get.

I'm trying to tell it to match that pattern in only those locations.

Nevermind I think I can go with this instead...

nawk '/33260[01]0[01]+ /{print $0 > "file"}'

thanks again for your help.