shell 怎么删除文件的最后一行
2016-04-19 13:18
399 查看
s
(2013-02-21 16:17:02)![](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
转载▼
|
删除文件最后一行
1. tail -n 1 file
2. tail -1 filename
3. sed -n ’$p’ filename
4. "awk ’END ’ file "
5.
ed file<br$ d
.
w
!
6. sed -i ’$d’ file
(注:方法1234都没有对原文件进行修改)
转载于 华夏名网
sed '/字符/d' 这个也行.
#Unix
相关文章推荐
- ShellExecute
- Shell : debug
- Windows下使用wxPython的pycrust交互shell方法。运行pywrap命令
- Linux Shell脚本之更新hosts文件以便于访问谷歌服务
- bash shell 的知识点--参考书
- linux 命令行和shell 脚本编程--了解shell
- Shell: test
- hbase经常使用的shell命令样例
- linux集群运维工具:clustershell和pssh
- Shell编程详解
- shell脚本基础知识
- Linux CentOS下shell显示-bash-4.1$不显示用户名路径的解决方法
- CMake 调用 Shell 脚本
- Linux shell学习
- linux shell: 取得某个目录下的文件名列表
- shell脚本学习心得
- shell中eval的神奇之法,shell中引号的争端
- shell脚本程序
- sprintf(cmd_buff,"%s_bak.exe",pExeName);ShellExecuteA(NULL,"open",cmd_buff,argvs,
- Linux中shell脚本自动输入密码