? Linux ?,???? printf
???? awk
?????????
- ??
printf
??:
printf
?????????????,?????????????????????:
- ???:
printf "%-10s %s\n" "column1" "column2"
- ???:
printf "s %s\n" "column1" "column2"
- ????:
printf "s %s\n" "column1" "column2" | awk '{printf "%*s%*s\n", (length($1)+length($2))/2, $1, (length($1)+length($2))/2, $2}'
- ??
awk
??:
awk
??????????????,?????????????????????:
- ???:
awk '{printf "%-10s %s\n", $1, $2}' input_file
- ???:
awk '{printf "s %s\n", $1, $2}' input_file
- ????:
awk '{printf "s %s\n", $1, $2} input_file | awk '{printf "%*s%*s\n", (length($1)+length($2))/2, $1, (length($1)+length($2))/2, $2}'
?????,%-10s
????????? 10 ????,s
????????? 10 ?????input_file
???????????????????????????