Can one do a tr within an awk

I am reading a file with awk, and because it is a fixed file using substr to select and write out parts of specific lines. However, one of my fields sometimes has extra characters. I know I can

awk 'substr($0,251,4)=="2008" {print substr($0,170,4)","substr($0,271,10)' $file_in >$fileout

But, that data at 271 for 10 characters might be
12345 which is good
12345a which I want to write as just 12345

in unix script, I could (assuming jbno contains my text)

jno=$(echo jbno | tr -d [a-zA-Z ])

to get rid of alpha characters and spaces

So, can something like that be done within an awk command?

Use the int() function of awk:

int(substr($0,271,10))

Regards;)

See the following as an example

> cat file31
10 abc12345a  
12 abd23231b
10 cab22220aa
09 x98756    
1  x87456za  

> awk '{print substr($0,4,10)}' file31
abc12345a 
abd23231b
cab22220aa
x98756    
x87456za  

> awk '{print int(substr($0,4,10))}' file31
0
0
0
0
0

I am looking for
12345
23231
22220
98756
87456

In that case you can do something like:

awk '{
s=substr($0,4,10)
gsub(/[^0-9]/,"",s)
print int(s)
}