Line 5: FIDE
INST_DESC: DIAM Co Ltd/Japan => MAID Co Ltd/Japan
INST_NME: DIAM Co Ltd/Japan => MAID Co Ltd/Japan
Line 6: FIDE
INST_DESC: DIAM DL/Pimco US Bond Open Born in the USA => MAID DL/Pimco US Bond Open Born in the USA
INST_NME: DIAM DL/Pimco US Bond Open Born in the USA => MAID DL/Pimco US Bond Open Born in the USA
awk 'NR == FNR {
/^[ ]*47name/ && c++ # get the field number
if (/^[ ]*47size/) {
split($0, t, ":")
gsub(/[ 47,]/, x, t[2]) # strip punctuation
fmt[c] = t[2] # get the size
}
next # run the above actions
} # + only for the first input file
{
for (i=1; i<=NF; i++) # output the strings in the correct format
printf "%" (length($i) > fmt[i] ? "." : "-" ) fmt[i] "s", $i
print x
}' config.txt temp.txt
#!/bin/bash
# Code for OSX 10.13.5. default UNICODE encoding.
echo""
echo "The default UTF-8..."
locale
echo""
echo "Change to 8 bit ASCII only..."
LANG="en_GB.US-ASCII"
export LANG="en_GB.US-ASCII"
locale
echo ""
for N in {0..255}
do
printf 'x'$( printf "%02x" "$N" )
done
echo ""