【无标题】

vim编辑器:
1. 默认模式(编辑模式)
1) 复制粘贴还原
nyy p  P   u  .   dd ndd  
2) 定位
gg  1G    G    nG
3) 查找
/字符 n    N
4) 替换
: 1,3 s/old/new/gic
: % s/old/new/gic
: 1,$ s/old/new/gic

2. 插入模式
i  o  a
I  O  A

3. 命令模式
:w   :q  :q!  :wq    :x  :e! :! 命令
:r 文件路径   : 1,3 w 

:set nu      :set nonu   :noh

4. 打开的几种方式
vim [-r] 文件名
vim [+] 文件名


grep 行过滤
aabb 
aa bb
after  before

cat 
more 
less
tail
head
vim
vi

cat 文件名 | grep [选项] '关键字'

grep [选项] '关键字' 文件名

#忽略大小写匹配包含 root 的行
grep -i 'root' passwd
#精确匹配 ftp 单词
grep -w 'ftp' passwd
#打印匹配到 root 关键字的行号
#忽略大小写匹配以 root 关键字开头的行号
#匹配包含 mail 关键字及其后5行
#匹配包含 mail 关键字及其前5行
#匹配包含 mail 关键字及其前后5行


egrep '([A-Z]|[0-9])' 
egrep '[A-Z0-9]'


word    匹配指定字符串(word)的值
^word    匹配以指定字符串开头的值  grep -n '^#' test.txt
word$    匹配以指定字符串结尾的值 grep -n '!$' test.txt
[abc]    匹配中括号中的任意一个字符,它们之间是或者关系 grep -n 'g[ld]' test.txt
[^list]    匹配不在中括号中指定的任意字符 grep -n 'oo[^t]' test.txt
[n1-n2]    匹配列出的选取范围!grep  -n '[A-Z]' test.txt   grep  -n '[a-z]' test.txt   grep  -n '[0-9]' test.txt
.        匹配任意一个字符  grep -n 'e.e' test.txt
\        转义字符,将特殊符号的特殊意义去除 grep –n '\.' test.txt
x|y        管道,表示或者关系 egrep 'ab|bc'
()        表示字符串分组 egrep '^a(b|c)$'


"Open Source" is a good mechanism to develop programs.
apple is my favorite food.
Football game is not use feet only.
GO
good
this dress doesn't fit me.
However, this dress is about $ 3183 dollars.^M
GNU is free air not free beer.^M
Her hair is very beauty.^M
I can't finish the test.^M
Oh! The soup taste good.^M
motorcycle is cheap than car.
This window is clear.
the symbol '*' is represented as start.
Oh!     My god!
The gd software is a library for drafting programs.^M
You are the best is mean you are the no. 1.
The world <Happy> is the same with "glad".
I like dog.
google is the best tools for search keyword.
goooooogle yes!
GO GOgo! go! Let's go.
GO
# I am Bobby

*    量词,匹配指定内容 零次或无穷次  grep -n 'ess*' test.txt
?    量词,匹配指定内容 零次或一次  egrep -n 'ess?' test.txt
+    量词,匹配指定内容 一次或多次  egrep -n 'ess+' test.txt

{n}        量词:匹配指定内容 n次  grep -n 'go{2}g' test.txt,使用egrep 可以不用转义
{n,m}    量词:匹配指定内容 n次到m次  grep -n 'go{2,3}g' test.txt
{n,}    量词:匹配指定内容 n次到无穷次  grep -n 'go{2,}g' test.txt


注册

用户名  大小字母数字_-组合,3-6位   [a-zA-Z0-9_-]{3,6}
昵称
邮箱   admin12@qq.com    @  
手机   ^1[2-9][0-9]{9}$
密码
密保

^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$


grep delegate /etc/* 2>  /dev/null

1. 编写正则表达式匹配密码强度
   强密码(字母、数字和特殊符号三种组合,长度8位以上)
   弱密码(字母或数字或特殊符号,长度6位到8位)

2. 查找test文件中包含go*gle 的行数据,
   显示行号和前后2行数据,并把查询结果保存到 google.txt 文件中

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值