nick34992
2/18/2017 - 9:12 PM

Bash: printf Align Left; Decimal Place

Bash: printf Align Left; Decimal Place

#!/bin/bash

printf "%-4s %-8s %-5s\n" No. Name Mark
printf "%-4s %-8s %-5.2f\n" 1 Miguel 25.6532
printf "%-4s %-8s %-5.2f\n" 2 Pooja 34.8653
printf "%-4s %-8s %-5.2f\n" 3 Robert 85.4586

# No.  Name     Mark 
# 1    Miguel   25.65
# 2    Pooja    34.87
# 3    Robert   85.46