BEGIN { lowercase="172"; uppercase="174"; v["040"]="0"; w["040"]=")"; v["001"]="1"; w["001"]="'"; v["002"]="2"; w["002"]="@"; v["023"]="3"; w["023"]="#"; v["004"]="4"; w["004"]="$"; v["025"]="5"; w["025"]="="; v["026"]="6"; w["026"]="pound"; v["007"]="7"; w["007"]="?"; v["010"]="8"; w["010"]="*"; v["031"]="9"; w["031"]="("; v["141"]="a"; w["141"]="A"; v["142"]="b"; w["142"]="B"; v["163"]="c"; w["163"]="C"; v["144"]="d"; w["144"]="D"; v["165"]="e"; w["165"]="E"; v["166"]="f"; w["166"]="F"; v["147"]="g"; w["147"]="G"; v["150"]="h"; w["150"]="H"; v["171"]="i"; w["171"]="I"; v["121"]="j"; w["121"]="J"; v["122"]="k"; w["122"]="K"; v["103"]="l"; w["103"]="L"; v["124"]="m"; w["124"]="M"; v["105"]="n"; w["105"]="N"; v["106"]="o"; w["106"]="O"; v["127"]="p"; w["127"]="P"; v["130"]="q"; w["130"]="Q"; v["111"]="r"; w["111"]="R"; v["062"]="s"; w["062"]="S"; v["043"]="t"; w["043"]="T"; v["064"]="u"; w["064"]="U"; v["045"]="v"; w["045"]="V"; v["046"]="w"; w["046"]="W"; v["067"]="x"; w["067"]="X"; v["070"]="y"; w["070"]="Y"; v["051"]="z"; w["051"]="Z"; v["000"]="empty"; w["000"]="empty"; v["013"]="STOP"; w["013"]="STOP"; v["020"]="space"; w["020"]="space"; v["032"]="P1"; w["032"]="P1"; v["073"]=","; w["073"]=","; v["076"]="TAB"; w["076"]="TAB"; v["100"]="-"; w["100"]="\""; v["112"]="P2"; w["112"]="P2"; v["133"]="%"; w["133"]="_"; v["153"]="."; w["153"]="."; v["160"]="&"; w["160"]=";"; v[lowercase]="lowercase"; w[lowercase]="lowercase"; v[uppercase]="uppercase"; w[uppercase]="uppercase"; v["177"]="TAPE FEED"; w["177"]="TAPE FEED"; case=0; } /^-l/ { p["0"]=0; p["1"]=1; p["2"]=1; p["3"]=2; p["4"]=1; p["5"]=2; p["6"]=2; p["7"]=3; for(i in v) { print i " lowercase " v[i] " parity " (p[substr(i,1,1)]+p[substr(i,2,1)]+p[substr(i,3,1)])%2; } print ""; for(i in w) { print i " uppercase " w[i] " parity " (p[substr(i,1,1)]+p[substr(i,2,1)]+p[substr(i,3,1)])%2; } exit; } !/^[0-7][0-7][0-7]$/ { print "USAGE: gawk --file=[path]flexowriter.awk /dev/null []"; print " reads 3-digit octal code from , stdin by default, and"; print " interprets is as Flexowriter , writing to stdout."; print " Enter \"-l[ist]\" to print the code chart (unsorted)."; print " Based on http://bitsavers.trailing-edge.com/pdf/friden/"; print " SP8673R2_Friden_Flexowriter_Programatic_Tech_Man_1962.pdf"; print " FRIDEN FLEXOWRIER CODE CHART for MODEL SPD"; print " from http://bitsavers.informatik.uni-stuttgart.de/pdf/friden/"; print "NOTE: On Windows(TM) use an empty file \"null\" i.s.o. /dev/null ."; print ""; print "VERSION"; print " Tested succesfully. 2014-04-11"; print " Table supplemented. 2014-06-03"; print ""; print "Copyright (C) 2014 by Harm J. Schoonhoven"; print ""; print "Permission is hereby granted, free of charge, to any person obtaining a copy"; print "of this software and associated documentation files (the \"Software\"), to deal"; print "in the Software without restriction, including without limitation the rights"; print "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"; print "copies of the Software, and to permit persons to whom the Software is"; print "furnished to do so, subject to the following conditions:"; print ""; print "The above copyright notice and this permission notice shall be included in"; print "all copies or substantial portions of the Software."; print ""; print "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"; print "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"; print "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"; print "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"; print "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"; print "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN" print "THE SOFTWARE."; exit; } { if($1==lowercase)case=0; if($1==uppercase)case=1; if(case==1)s=w[$1]; else s=v[$1]; if(s=="")s="??"; print $0 "\t" s; }