: !/bin/sh # convert MMYYYY to YYYYxMM (TBSdata tBatch.BillingPeriod) awk -v "MMYYYY=$1" -v "sep=$2" ' BEGIN { mm = 0 + substr(MMYYYY,1,2); yyyy = 0 + substr(MMYYYY,3,4); YYYYMM = sprintf("%04d%s%02d", yyyy, sep, mm); print YYYYMM exit }' exit 0