How to add 100 spaces at end of each line of a file in Unix

后端 未结 7 1269
名媛妹妹
名媛妹妹 2021-01-12 07:17

I have a file which is supposed to contain 200 characters in each line. I received a source file with only 100 characters in each line. I need to add 100 extra white spaces

7条回答
  •  爱一瞬间的悲伤
    2021-01-12 07:29

    You can use printf in awk:

    awk '{printf "%s%*.s\n", $0, 100, " "}' filename > newfile
    

    This printf will append 100 spaces at the end of each newline.

提交回复
热议问题