Removing last blank line

前端 未结 5 1614
礼貌的吻别
礼貌的吻别 2021-02-12 14:50

There is a para break at the end of my .csv file. I tried to remove the blank line that is at the end of the file using the following command.

sed -i \'/^$/d\' c         


        
5条回答
  •  情书的邮戳
    2021-02-12 15:10

    To remove blank lines you can use grep . or sed '/^$/d'

    It will remove any blank line in the file. I hope you file does not have any blank lines in the middle but this will work in your case.

    cat combined.csv | grep .

    or

    cat combined.csv | sed '/^$/d'

提交回复
热议问题