skip to content
Alvin Lucillo

Right padding text

/ 1 min read

💻 Tech

You can left-align values by adding right padding. In the example below, ID has fixed width, so the excess space will be spaces.

printf "%-10s %-20s %-15s\n" "ID" "Name" "Age"
printf "%-10s %-20s %-15s\n" "101" "Alice" "25"

ID         Name                 Age
101        Alice                25