开发者

awk to provide extra space?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜