I am trying to create a file with a header as well as some extracts from the input files.. I am always getting space alignment issues through I am using fixed space..
Any advise pls.. Thanks, here is the sample code
# print header
printf '%-50s | %-30s | %-30s | %-30s | %-30s | %-30s %-5s \n' "FileName" "Amount Rec" "Payments" "Total Adjustments" "Adjustment Amount" "File Date" "|" >> $msgfile
for file in "$SEARCH_DIR"/*; do
file=`basename "$file"`
recamt=$(awk -F "*" '/BPR/{print $3}' $file)
amount1=$(awk -F "*" '/TS3/{print $5}' $file)
amount1=$(awk -F "*" '/PLB/{print $7}' $file)
printf '%-50s | %-30s | %-30s | %-30s | %-30s | %-30s %-5s \n' "$file" "$recamt" "$amount1" "1" "$amount1" "$weekdate" "|" >> $msgfile
The output when I open it in notepad looks good, but when I send this as a email ( mailx), I see space issues the output.. Any thoughts ?
My output values as below..
xxxxxxx.xxxxx.xxxxxxxxx.txt | 906262.23 | 393 | 1 | 75297.4 | 06-Mar-2019 |