BEGIN { print "P2" print "81 41" print "25" } { split($0,arr,"") r = "" #for (a in arr) { # print a, arr[a] #} #nextfile for (i=1;i<=81;i++) { c = arr[i] if (c == "S") { v = 0 } else if (c == "E") { v = 25 } else { v = index("abcdefghijklmnopqrstuvwxyz", c)-1 } r = r " " v } print r }