开发者

awk to provide extra space?

开发者 https://www.devze.com 2023-01-24 23:42 出处:网络
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 spe

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号