Printf examples

awk

awk -F: '{ printf("%-15s %s\n", $1, $5) }' /etc/passwd

perl

printf "%-21s %-s\n", "--from", "search envelope sender address";

shell

printf "%-9s %-16s %-8s %-8s\n" "Switch" "MAC address" "Module" "Port" > $OUTPUT_FILE

Back to brandonhutchinson.com.
Last modified: 2007/08/03