linux中删除文本的最后一行
001、
[root@pc1 test]# ls test.txt [root@pc1 test]# cat test.txt 1 2 3 4 5 [root@pc1 test]# sed "$d" test.txt 1 2 3 4 5 [root@pc1 test]# sed '$d' test.txt ## sed单引号实现 1 2 3 4

002、
[root@pc1 test]# ls test.txt [root@pc1 test]# cat test.txt 1 2 3 4 5 [root@pc1 test]# head -n -1 test.txt ## head 实现 1 2 3 4


浙公网安备 33010602011771号