Bash working code to delete first or last line from file

前端 未结 7 1964
面向向阳花
面向向阳花 2021-01-11 10:31

I saw the sed examples, but no matter how I write that it won\'t delete my first line. Actually, I did more tests and it won\'t delete my first line either, so

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-11 11:26

    Here you go ! delete first line (also BSD/MacOS compatible)

    sed '1,1d' file1  >> file1.out
    

    delete last row/line

    sed '$d' file2  >> file2.out 
    

提交回复
热议问题