How to insert a new line character after a fixed number of characters in a file

前端 未结 7 591
别那么骄傲
别那么骄傲 2020-12-02 12:16

I am looking for a bash or sed script (preferably a one-liner) with which I can insert a new line character after a fixed number of characters in huge text file.

7条回答
  •  情书的邮戳
    2020-12-02 13:00

    How about something like this? Change 20 is the number of characters before the newline, and temp.text is the file to replace in..

    sed -e "s/.\{20\}/&\n/g" < temp.txt
    

提交回复
热议问题