{ if ($0 !~ /[^0123456789LMCP *(),.\\]/ && $0!="") { i=substr($0,1,5)+0 j=substr($0,6,1) z=substr($0,8) lm=index(z,"L.M") # Print the exponent print i # Determine and print the type of record if (j==" ") if (lm==0) type=1 # Normal else type=3 # Aurifeuillian (L.M case) else type=2 # Aurifeuillian for 2LM table only print type # Process the record depending on which type it is if (type==1) { # Piece back together broken lines last=substr($0,length($0),1) while (last=="." || last=="\\" || last==" " || last==")") { if (last=="\\") z=substr(z,1,length(z)-1) getline z=z substr($0,match($0,/[0-9CP]/)) last=substr($0,length($0),1) } # Strip off blanks and *'s. Replace ,'s with .'s. gsub(/ /,"",z) gsub(/\*/,"",z) gsub(/\,/,".",z) # Unwind the main line if (substr(z,1,1)=="(") { r=index(z,")") print "(" q=substr(z,2,r-2) gsub(/\./,"\n",q) print q print ")" q=substr(z,r+1) gsub(/\./,"\n",q) print q } else { gsub(/\./,"\n",z) print z } # Print the record terminator print "#" } else if (type==2) { # Print L factor indicator print "L" # Piece back together broken lines last=substr($0,length($0),1) while (last=="." || last=="\\" || last==" " || last==")") { if (last=="\\") z=substr(z,1,length(z)-1) getline z=z substr($0,match($0,/[0-9CP]/)) last=substr($0,length($0),1) } # Strip off blanks and *'s. Replace ,'s with .'s. gsub(/ /,"",z) gsub(/\*/,"",z) gsub(/\,/,".",z) # Unwind the main line if (substr(z,1,1)=="(") { r=index(z,")") print "(" q=substr(z,2,r-2) gsub(/\./,"\n",q) print q print ")" q=substr(z,r+1) gsub(/\./,"\n",q) print q } else { gsub(/\./,"\n",z) print z } # Print M factor indicator print "M" # Piece back together broken lines getline z=substr($0,8) last=substr(z,length(z),1) while (last=="." || last=="\\" || last==" " || last==")") { if (last=="\\") z=substr(z,1,length(z)-1) getline z=z substr($0,match($0,/[0-9CP]/)) last=substr($0,length($0),1) } # Strip off blanks and *'s. Replace ,'s with .'s. gsub(/ /,"",z) gsub(/\*/,"",z) gsub(/\,/,".",z) # Unwind the main line if (substr(z,1,1)=="(") { r=index(z,")") print "(" q=substr(z,2,r-2) gsub(/\./,"\n",q) print q print ")" q=substr(z,r+1) gsub(/\./,"\n",q) print q } else { gsub(/\./,"\n",z) print z } # Print the record terminator print "#" } else { # Piece back together broken lines last=substr($0,length($0),1) while (last=="." || last=="\\" || last==" " || last==")") { if (last=="\\") z=substr(z,1,length(z)-1) getline z=z substr($0,match($0,/[0-9CP]/)) last=substr($0,length($0),1) } # Strip off blanks and *'s. Replace ,'s with .'s. Remove the L.M construct gsub(/ /,"",z) gsub(/\*/,"",z) sub(/L\.M/,"",z) gsub(/\,/,".",z) # Unwind the main line if (substr(z,1,1)=="(") { r=index(z,")") print "(" q=substr(z,2,r-2) gsub(/\./,"\n",q) print q print ")" } # Print L factor indicator print "L" # Piece back together broken lines getline z=substr($0,8) last=substr(z,length(z),1) while (last=="." || last=="\\" || last==" " || last==")") { if (last=="\\") z=substr(z,1,length(z)-1) getline z=z substr($0,match($0,/[0-9CP]/)) last=substr($0,length($0),1) } # Strip off blanks and *'s. Replace ,'s with .'s. gsub(/ /,"",z) gsub(/\*/,"",z) gsub(/\,/,".",z) # Unwind the main line if (substr(z,1,1)=="(") { r=index(z,")") print "(" q=substr(z,2,r-2) gsub(/\./,"\n",q) print q print ")" q=substr(z,r+1) gsub(/\./,"\n",q) print q } else { gsub(/\./,"\n",z) print z } # Print M factor indicator print "M" # Piece back together broken lines getline z=substr($0,8) last=substr(z,length(z),1) while (last=="." || last=="\\" || last==" " || last==")") { if (last=="\\") z=substr(z,1,length(z)-1) getline z=z substr($0,match($0,/[0-9CP]/)) last=substr($0,length($0),1) } # Strip off blanks and *'s. Replace ,'s with .'s. gsub(/ /,"",z) gsub(/\*/,"",z) gsub(/\,/,".",z) # Unwind the main line if (substr(z,1,1)=="(") { r=index(z,")") print "(" q=substr(z,2,r-2) gsub(/\./,"\n",q) print q print ")" q=substr(z,r+1) gsub(/\./,"\n",q) print q } else { gsub(/\./,"\n",z) print z } # Print the record terminator print "#" } } if ($0 ~ /Table/) print substr($0,match($0,/Table/)) }