use*_*256 4 command-line shell text-processing
如何n
使用 shell 命令删除ascii 文件的最后几行?
cha*_*aos 12
使用head
(删除最后两行):
head -n -2 file
Run Code Online (Sandbox Code Playgroud)
使用sed
/ tac
(删除最后 2 行):
tac file | sed "1,2d" | tac
Run Code Online (Sandbox Code Playgroud)
tac
反转文件,sed
删除 ( d
) 行1
到2
(2
可以是任意数字)。