Removing last blank line

前端 未结 5 1514
礼貌的吻别
礼貌的吻别 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:13

    Try ${/^$/d;} this will only match an empty line if it is the last line of the file.

    Update: for your second question, just remove the 1 before the s, i.e.: sed -i 's/^[^0-9]*//' combined.csv

提交回复
热议问题