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

后端 未结 7 1219
名媛妹妹
名媛妹妹 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:31

    With awk

    awk '{printf "%s%100s\n", $0, ""}' file.dat
    

    $0 refers to the entire line.

提交回复
热议问题