7.2. vim
发布日期:2021-09-08 15:09:22 浏览次数:5 分类:技术文章

本文共 1961 字,大约阅读时间需要 6 分钟。

7.2.1. 查找与替换

s%/aaa/bbb/g
Starting Nmap 5.21 ( http://nmap.org ) at 2012-02-02 17:03 CSTNSE: Script Scanning completed.Nmap scan report for 10.10.1.1Host is up (0.0072s latency).The 1 scanned port on 10.10.1.1 is filteredNmap scan report for 10.10.1.2Host is up (0.0064s latency).The 1 scanned port on 10.10.1.2 is closedNmap scan report for 10.10.1.3Host is up (0.0071s latency).The 1 scanned port on 10.10.1.3 is closedNmap scan report for 10.10.1.4Host is up (0.0072s latency).PORT     STATE SERVICE3306/tcp open  mysql| mysql-info: Protocol: 10| Version: 5.1.54-log| Thread ID: 37337702| Some Capabilities: Long Passwords, Connect with DB, Compress, ODBC, Transactions, Secure Connection| Status: Autocommit|_Salt: y0!QV;ekiN)"kx;\=Y+gNmap scan report for 10.10.1.5Host is up (0.0081s latency).PORT     STATE SERVICE3306/tcp open  mysql| mysql-info: Protocol: 10| Version: 5.1.48-community-log| Thread ID: 6655211| Some Capabilities: Long Passwords, Connect with DB, Compress, ODBC, Transactions, Secure Connection| Status: Autocommit|_Salt: i3ap1?+UL^q>$5~=UqYJNmap scan report for 10.10.1.6Host is up (0.0073s latency).The 1 scanned port on 10.10.1.6 is closedNmap scan report for www.example.com (10.10.1.7)Host is up (0.0074s latency).The 1 scanned port on www.example.com (10.10.1.7) is closed

删除closed上面2行

:%s:.*\n.*\n.*closed$::g:%s/\n\n\n//g

7.2.2. 插入文件

当前光标处插入文件

:r /etc/passwd

第十行处插入文件

:10 r /etc/passwd

7.2.3. 批处理

test script

vim test.txt <
/dev/null 2>&1:%s/neo/neo chen/g:%s/hello/hello world/g:wqend

test.txt

beginneotesthelloworldend

test result

$ ./test$ cat test.txtbeginneo chentesthello worldworldendneo@netkiller:/tmp$

7.2.3.1. vi 批处理

for i in file_list do vi $i <<-! :g/xxxx/s//XXXX/g :wq ! done

7.2.4. line()

加入行号

:g/^/ s//\=line('.').' '/

7.2.5. set fileformat

加入行号

vim    set fileformat执行 set fileformat  会返回当前文件的 format 类型 如:fileformat=dos也可执行 set line

原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

转载地址:https://blog.csdn.net/weixin_34326429/article/details/90192379 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Java的垃圾回收之算法
下一篇:前端开发中的JS调试技巧

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2024年04月12日 01时44分17秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

Java SSM 项目实战 day03 功能介绍,订单的操作,订单的增删改查 2019-04-26
Java SSM 项目实战 day04 功能介绍,订单的操作,订单的增删改查,实现登录功能 2019-04-26
Android Studio 实现登录注册-源代码 (连接MySql数据库) 2019-04-26
C/C++语言数据结构快速入门(一)(代码解析+内容解析)数据结构基本内容和线性表 2019-04-26
Android Studio 实现登录注册-源代码 二(Servlet + 连接MySql数据库) 2019-04-26
Java SSM 项目实战 day05 用户操作 2019-04-26
第七届 互联网+大赛 报名详细流程 全国大学生创业网 (保姆级指南:如何同意对方邀请) 2019-04-26
Java SSM 项目实战 day06 角色操作,资源权限操作 2019-04-26
Java SSM 项目实战 day07 SpringSecurity源码分析 2019-04-26
Android Studio 实现实现学生信息的查询 -源代码 三(Servlet + 连接MySql数据库) (JSON通信) 2019-04-26
Android Studio 实现实现学生信息的增删改查 -源代码 四(Servlet + 连接MySql数据库) 2019-04-26
Java SSM 项目实战 day07用户角色关联操作,添加角色,以及添加权限 2019-04-26
Java SSM 项目实战 day08 方法级别的权限操作 服务器端的权限控制(JSR-250注解)(支持表达式的注解)(@Secured)以及页面端的权限控制 2019-04-26
(精华)2020年6月25日 JavaScript高级篇 对象属性 2019-04-26
(精华)2020年6月25日 JavaScript高级篇 数据类型 2019-04-26
(精华)2020年6月25日 JavaScript高级篇 对象类型 2019-04-26
(精华)2020年6月25日 JavaScript高级篇 click事件(冒泡,捕获,委托) 2019-04-26
(精华)2020年7月4日 JavaScript高级篇 ES6(class类的继承) 2019-04-26
(精华)2020年7月5日 JavaScript高级篇 ES6(async和await) 2019-04-26
(精华)2020年7月5日 Node.js require和module 2019-04-26