can s开发者_如何学Pythonome one please tell me, how can I write a awk program to provide extra space at the end of a line if required. So that the line length is maintained at 127 ?
A %-127s
format specifier pads a string to 127 characters:
awk '{printf "%-127s\n", $0}'
You could also do this in straight bash:
while read LINE; do printf "%-127s\n" "$LINE"; done
精彩评论