常用shell命令
来源:互联网 发布:爱淘宝首页登录 编辑:程序博客网 时间:2024/05/21 17:07
1. 打印两行
grep -A 1 "c_timestamp" a.log
2. 批量增加当前行的下一行
sed -i "/c_timestamp/a field_type:TIMESTAMP" a.log
3. 批量删除匹配行的下一行
sed -i "/c_timestamp/{n;d}" a.log
4. 批量删除匹配行
sed -i "/compare_file \$client_output22219_SNAPSHOT/d" ./a.sh
sed -i "/compare_file \$client_output22219_SNAPSHOT/d" ./a.sh
4. 在匹配行之后插入一行
sed -i "/expect_result2/ a expect_result3=\"\$c_path/expect_binary.log\"" ./*/a.sh
5. 修改匹配行的下一行
sed ’/test/{ n; s/aa/bb/; }’ example—–如果test被匹配,则移动到匹配行的下一行,替换这一行的aa,变为bb,并打印该行,然后继续。
6. 在文件最后一行插入新行
sed -i "$ a server.messageType = text" ./demo.properties
7. 批量修改匹配行
sed -i "/finishrateServer/ s/10.10.10.107/10.94.97.137/g" ./a.conf
8. awk取匹配行 第三列
awk '{if($2~/^1$/)print}' ./a.txt >text.txt
阅读全文
0 0
- 几个常用SHELL命令
- Linux常用shell命令
- Linux常用shell命令
- 常用Windows Shell命令
- 常用shell命令
- 常用shell命令
- 常用的shell命令
- 常用shell命令
- 常用shell命令
- 常用shell命令
- 常用 shell 命令 -tar
- shell 常用的命令
- Linux常用Shell命令
- 常用的Shell命令
- linux 常用shell命令
- linux常用shell命令
- 常用Shell命令之一
- 常用shell命令
- 【BZOJ】3295 [Cqoi2011]动态逆序对 树状数组+线段树
- 斯特林公式(阶乘近似值)
- python 中文件、目录比较
- [Periodic Strings, UVA455 ]
- Django中静态文件的设置
- 常用shell命令
- 2017.10思考
- TLD自定义标签步骤
- 通过网页链接调用QQ临时会话实现
- 最新版redis的安装及配置
- C++ 知识汇总
- 使用intent切换活动
- 什么是框架?
- 【STL】list源码剖析