find、grep、sed、awk命令(总结)
find、grep、sed、awk命令(总结)
大纲
*一、常见系统特殊符号*
*(一)基础符号系列*
*1)美元符号 $*
*2)叹号符号 !*
*3)竖线符号 |*
*4)井号符号 #*
*(二)引号符号系列*
*(三)定向符号系列*
*(四)路径符号系列*
*(五)逻辑符号系列*
*二、常见通配符号*
*(一)通配符号作用*
*(二)通配符号企业应用*
*三、find(以文件为单位进行查找后删除复制移动)*
*三、正则符号*
*(一)正则符号作用说明*
*(二)正则表达符号分类*
*(三)正则符号注意事项*
*(四)基础正则符号说明*
*(五)扩展正则符号说明*
*(六)正则符号使用问题*
*(七)正则符号特性说明*
*五、grep(过滤筛选信息)*
*六、sed(修改替换文件内容 擅长对文件中的行进行操作)*
*1)概念介绍*
*2)sed命令的执行流程*
*3)sed命令实际应用*
*七、awk(擅长统计分析文件内容 擅长对文件中列进行操作)*
*1)概念介绍*
*2)awk命令执行过程*
*3)awk命令的实际应用*
一、常见系统特殊符号
(一)基础符号系列
1)美元符号 $
1.用于取出变量中的内容
2.用于取出指定列的信息(awk)
3.表示用户命令提示符号
超级用户为 #
普通用户为 $
2)叹号符号 !
1.用于表示取反或者排除意思
2.命令行中表示取出最近命令
!awk(慎用)
history|grep awk
3.用于表示强制操作处理
vim底行模式保存 退出 wq! q!
3)竖线符号 |
1.表示管道符号,管道前面命令,交给管道后面执行
2.经常配合xargs命令使用
经常配合xargs命令使用
查找指定数据信息进行删除
find /test -type f -name "test*.txt"|xargs rm
find /test -type f -name "test*.txt" -exec rm -rf {} ;
find /test -type f -name "test*.txt" -delete
这三条命令都是用于删除 `/test` 目录下符合 "test*.txt" 模式的文件。它们执行相同任务,但采用了略微不同的方法。以下是每条命令的解释:
1. `find /test -type f -name "test*.txt"|xargs rm`
这条命令首先使用 `find` 命令在 `/test` 目录下查找所有类型为普通文件(-type f)且文件名符合 "test*.txt" 模式的文件,然后通过管道 `|` 将这些文件名传递给 `xargs` 命令,最后由 `rm` 命令批量删除这些文件。
2. `find /test -type f -name "test*.txt" -exec rm -rf {} \;`
这条命令同样使用 `find` 命令定位到目标文件,但它使用 `-exec` 参数直接对查找到的每个文件执行 `rm -rf` 命令进行删除操作。`{}` 作为占位符代表 `find` 找到的每一个文件路径。
3. `find /test -type f -name "test*.txt" -delete`
这是最简洁的写法,从 `find` 命令 4.0 版本开始支持 `-delete` 选项。这条命令表示在 `/test` 目录下查找并直接删除所有匹配 "test*.txt" 模式的普通文件。这种方式更为安全和高效,因为它避免了通过管道或 `-exec` 子命令调用外部命令可能导致的问题。
查找指定数据信息进行复制
find /test -type f -name "test*.txt" |xargs -i cp {} /test01/
find /test -type f -name "test*.txt" |xargs cp -t /test01/
find /test -type f -name "test*.txt" -exec cp -a {} /test01 ;
1. `find /test -type f -name "test*.txt" |xargs -i cp {} /test01/`
这条命令首先使用 `find` 命令找到所有匹配的文件,然后通过管道 `|` 将这些文件路径传递给 `xargs` 命令。这里的 `-i` 参数表示在执行 `cp` 命令时替换 `{}` 为实际的文件名。所以这条命令的作用是逐个将找到的文件复制到 `/test01/` 目录下。
2. `find /test -type f -name "test*.txt" |xargs cp -t /test01/`
这条命令与上一条类似,但更简洁,它利用了 `cp` 命令的 `-t` 选项,该选项后面跟的是目标目录。`xargs` 会自动将找到的文件作为参数传给 `cp` 命令,一次性复制多个文件到 `/test01/` 目录。
3. `find /test -type f -name "test*.txt" -exec cp -a {} /test01 \;`
这条命令采用 `-exec` 参数直接在 `find` 命令内部调用 `cp` 命令,`-a` 选项用于保留源文件的所有属性(如权限、时间戳等)进行复制。`{}` 表示 `find` 找到的每个文件,将其逐一复制到 `/test01/` 目录下。
查找指定数据信息进行移动
find /test -type f -name "test*.txt" |xargs -i mv {} /test01/
find /test -type f -name "test*.txt" |xargs mv -t /test01/
find /test -type f -name "test*.txt" -exec mv {} /test01 ;
1. `find /test -type f -name "test*.txt" |xargs -i mv {} /test01/`
这条命令首先使用 `find` 命令找到所有匹配的文件,然后通过管道 `|` 将这些文件路径传递给 `xargs` 命令,并且 `-i` 参数会在执行 `mv` 命令时用 `{}` 代表实际的文件名。所以这条命令的作用是逐个将找到的文件从原位置移动到 `/test01/` 目录下。
2. `find /test -type f -name "test*.txt" |xargs mv -t /test01/`
这条命令与上一条类似,它利用了 `mv` 命令的 `-t` 选项,该选项后面跟的是目标目录。`xargs` 将找到的所有文件作为参数一次性传递给 `mv` 命令,从而将多个文件一起移动到 `/test01/` 目录下。
3. `find /test -type f -name "test*.txt" -exec mv {} /test01 \;`
这条命令采用 `-exec` 参数直接在 `find` 命令内部调用 `mv` 命令,`{}` 表示 `find` 找到的每个文件,将其逐一从原位置移动到 `/test01/` 目录下。这个方法也是逐个处理文件,但相比管道和 `xargs` 的方式,命令结构更为直观。
查找指定数据信息按照日期 --主要用于批量删除历史数据信息
查找7天以前的数据: find /test -type f -mtime +7
查找最近7天的数据: find /test -type f -mtime -7
查找距今第7天数据: find /test -type f -mtime 7
root@master test]# find /test -type f -mtime +7
[root@master test]# find /test -type f -mtime -7
/test/test31.txt
/test/test32.txt
/test/test33.txt
/test/test34.txt
/test/test35.txt
/test/test36.txt
/test/test37.txt
/test/test38.txt
/test/test39.txt
/test/test40.txt
[root@master test]# find /test -type f -mtime 7
Find 掌握这些 够用了
(1)find工具name参数案例,详解如下
find /data -name "txt”":查找/data/目录以xxt结尾的文件
find /data -name "[A-Z]”:查找/data/目录以大写字母开头的文件
find /data -name “test”:#查找/data/目录以test开头的文件
root@master data]# find /data -type f -name "txt"
/data/txt
[root@master data]# find /data -name "[A-Z]"
/data/A
/data/B
/data/C
/data/D
/data/E
/data/F
/data/G
/data/H
/data/I
/data/J
/data/K
/data/L
/data/M
/data/N
/data/O
/data/P
/data/Q
/data/R
/data/S
/data/T
/data/U
/data/V
/data/W
/data/X
/data/Y
/data/Z
[root@master data]# find /data -name "test"
/data/test
(2)fnd工具-type参数案例,详解如下
find /data -type d:查找/data/目录下的文件夹
find / data ! type d:查找/data/目录下的非文件夹
find /data -type I:查找/data/目录下的链接文件
find /data -type d | xargs chmod 755 -R:查找目录类型并将权限设置为755
find /data -type f |xargs chmod 644 -R:查找文件类型并将权限设置为644
[root@master data]# find /data -type d
/data
[root@master data]# find /data ! -type d
/data/test.txt
/data/test1.txt
/data/test2.txt
/data/test3.txt
/data/test4.txt
/data/test5.txt
/data/test6.txt
/data/test7.txt
/data/test8.txt
/data/test9.txt
/data/test10.txt
/data/test11.txt
/data/test12.txt
/data/test13.txt
/data/test14.txt
/data/test15.txt
/data/test16.txt
/data/test17.txt
/data/test18.txt
/data/test19.txt
/data/test20.txt
/data/test21.txt
/data/test22.txt
/data/test23.txt
/data/test24.txt
/data/test25.txt
/data/test26.txt
/data/test27.txt
/data/test28.txt
/data/test29.txt
/data/test30.txt
/data/test31.txt
/data/test32.txt
/data/test33.txt
/data/test34.txt
/data/test35.txt
/data/test36.txt
/data/test37.txt
/data/test38.txt
/data/test39.txt
/data/test40.txt
/data/txt1.txt
/data/txt2.txt
/data/txt3.txt
/data/txt4.txt
/data/txt5.txt
/data/txt6.txt
/data/txt7.txt
/data/txt8.txt
/data/txt9.txt
/data/txt10.txt
/data/txt
/data/A
/data/B
/data/C
/data/D
/data/E
/data/F
/data/G
/data/H
/data/I
/data/J
/data/K
/data/L
/data/M
/data/N
/data/O
/data/P
/data/Q
/data/R
/data/S
/data/T
/data/U
/data/V
/data/W
/data/X
/data/Y
/data/Z
/data/test
[root@master data]# ls -s /data/txt /data/txt1.txt
0 /data/txt 0 /data/txt1.txt
[root@master test01]# ls -l
total 4
-rw-r--r-- 1 root root 0 Mar 14 00:20 test10.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test11.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test12.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test13.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test14.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test15.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test16.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test17.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test18.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test19.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test1.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test20.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test21.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test22.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test23.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test24.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test25.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test26.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test27.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test28.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test29.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test2.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test30.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test3.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test4.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test5.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test6.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test7.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test8.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test9.txt
-rw-r--r-- 1 root root 48 Mar 14 00:14 test.txt
[root@master test01]# ^C
[root@master test01]# ln -sf /data/txt /test01/test.txt
[root@master test01]# ll
total 0
-rw-r--r-- 1 root root 0 Mar 14 00:20 test10.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test11.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test12.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test13.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test14.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test15.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test16.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test17.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test18.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test19.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test1.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test20.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test21.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test22.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test23.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test24.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test25.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test26.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test27.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test28.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test29.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test2.txt
-rw-r--r-- 1 root root 0 Mar 14 00:21 test30.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test3.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test4.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test5.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test6.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test7.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test8.txt
-rw-r--r-- 1 root root 0 Mar 14 00:20 test9.txt
lrwxrwxrwx 1 root root 9 Mar 14 00:38 test.txt -> /data/txt
[root@master test01]# find /data -type d|xargs chmod 755 -R
[root@master test01]# cd /data
[root@master data]# ll
total 8
-rwxr-xr-x 1 root root 0 Mar 14 00:28 A
-rwxr-xr-x 1 root root 0 Mar 14 00:28 B
-rwxr-xr-x 1 root root 0 Mar 14 00:28 C
-rwxr-xr-x 1 root root 0 Mar 14 00:28 D
-rwxr-xr-x 1 root root 0 Mar 14 00:28 E
-rwxr-xr-x 1 root root 0 Mar 14 00:28 F
-rwxr-xr-x 1 root root 0 Mar 14 00:28 G
-rwxr-xr-x 1 root root 0 Mar 14 00:28 H
-rwxr-xr-x 1 root root 0 Mar 14 00:28 I
-rwxr-xr-x 1 root root 0 Mar 14 00:28 J
-rwxr-xr-x 1 root root 0 Mar 14 00:28 K
-rwxr-xr-x 1 root root 0 Mar 14 00:28 L
-rwxr-xr-x 1 root root 0 Mar 14 00:28 M
-rwxr-xr-x 1 root root 0 Mar 14 00:28 N
-rwxr-xr-x 1 root root 0 Mar 14 00:28 O
-rwxr-xr-x 1 root root 0 Mar 14 00:28 P
-rwxr-xr-x 1 root root 0 Mar 14 00:28 Q
-rwxr-xr-x 1 root root 0 Mar 14 00:28 R
-rwxr-xr-x 1 root root 0 Mar 14 00:28 S
-rwxr-xr-x 1 root root 0 Mar 14 00:28 T
-rwxr-xr-x 1 root root 0 Mar 14 00:29 test
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test10.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test11.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test12.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test13.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test14.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test15.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test16.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test17.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test18.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test19.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test1.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test20.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test21.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test22.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test23.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test24.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test25.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test26.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test27.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test28.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test29.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test2.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test30.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test31.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test32.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test33.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test34.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test35.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test36.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test37.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test38.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test39.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test3.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test40.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test4.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test5.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test6.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test7.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test8.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:26 test9.txt
-rwxr-xr-x 1 root root 5559 Mar 13 03:32 test.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:28 txt
-rwxr-xr-x 1 root root 0 Mar 14 00:27 txt10.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:27 txt1.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:27 txt2.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:27 txt3.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:27 txt4.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:27 txt5.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:27 txt6.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:27 txt7.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:27 txt8.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:27 txt9.txt
-rwxr-xr-x 1 root root 0 Mar 14 00:28 U
-rwxr-xr-x 1 root root 0 Mar 14 00:28 V
-rwxr-xr-x 1 root root 0 Mar 14 00:28 W
-rwxr-xr-x 1 root root 0 Mar 14 00:28 X
-rwxr-xr-x 1 root root 0 Mar 14 00:28 Y
-rwxr-xr-x 1 root root 0 Mar 14 00:28 Z
[root@master data]# ^C
[root@master data]# find /data -type f |xargs chmod 644 -R
[root@master data]# ll
total 8
-rw-r--r-- 1 root root 0 Mar 14 00:28 A
-rw-r--r-- 1 root root 0 Mar 14 00:28 B
-rw-r--r-- 1 root root 0 Mar 14 00:28 C
-rw-r--r-- 1 root root 0 Mar 14 00:28 D
-rw-r--r-- 1 root root 0 Mar 14 00:28 E
-rw-r--r-- 1 root root 0 Mar 14 00:28 F
-rw-r--r-- 1 root root 0 Mar 14 00:28 G
-rw-r--r-- 1 root root 0 Mar 14 00:28 H
-rw-r--r-- 1 root root 0 Mar 14 00:28 I
-rw-r--r-- 1 root root 0 Mar 14 00:28 J
-rw-r--r-- 1 root root 0 Mar 14 00:28 K
-rw-r--r-- 1 root root 0 Mar 14 00:28 L
-rw-r--r-- 1 root root 0 Mar 14 00:28 M
-rw-r--r-- 1 root root 0 Mar 14 00:28 N
-rw-r--r-- 1 root root 0 Mar 14 00:28 O
-rw-r--r-- 1 root root 0 Mar 14 00:28 P
-rw-r--r-- 1 root root 0 Mar 14 00:28 Q
-rw-r--r-- 1 root root 0 Mar 14 00:28 R
-rw-r--r-- 1 root root 0 Mar 14 00:28 S
-rw-r--r-- 1 root root 0 Mar 14 00:28 T
-rw-r--r-- 1 root root 0 Mar 14 00:29 test
-rw-r--r-- 1 root root 0 Mar 14 00:26 test10.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test11.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test12.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test13.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test14.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test15.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test16.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test17.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test18.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test19.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test1.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test20.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test21.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test22.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test23.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test24.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test25.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test26.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test27.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test28.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test29.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test2.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test30.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test31.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test32.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test33.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test34.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test35.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test36.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test37.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test38.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test39.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test3.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test40.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test4.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test5.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test6.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test7.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test8.txt
-rw-r--r-- 1 root root 0 Mar 14 00:26 test9.txt
-rw-r--r-- 1 root root 5559 Mar 13 03:32 test.txt
-rw-r--r-- 1 root root 0 Mar 14 00:28 txt
-rw-r--r-- 1 root root 0 Mar 14 00:27 txt10.txt
-rw-r--r-- 1 root root 0 Mar 14 00:27 txt1.txt
-rw-r--r-- 1 root root 0 Mar 14 00:27 txt2.txt
-rw-r--r-- 1 root root 0 Mar 14 00:27 txt3.txt
-rw-r--r-- 1 root root 0 Mar 14 00:27 txt4.txt
-rw-r--r-- 1 root root 0 Mar 14 00:27 txt5.txt
-rw-r--r-- 1 root root 0 Mar 14 00:27 txt6.txt
-rw-r--r-- 1 root root 0 Mar 14 00:27 txt7.txt
-rw-r--r-- 1 root root 0 Mar 14 00:27 txt8.txt
-rw-r--r-- 1 root root 0 Mar 14 00:27 txt9.txt
-rw-r--r-- 1 root root 0 Mar 14 00:28 U
-rw-r--r-- 1 root root 0 Mar 14 00:28 V
-rw-r--r-- 1 root root 0 Mar 14 00:28 W
-rw-r--r-- 1 root root 0 Mar 14 00:28 X
-rw-r--r-- 1 root root 0 Mar 14 00:28 Y
-rw-r--r-- 1 root root 0 Mar 14 00:28 Z
(3)find工具size参数案例,详解如下
find /data -size +1M:查找文件大小大于1MB的文件
find /data -size 10M:查找文件大小为10MB的文件。
find /data -size -1M:查找文件大小小于1MB的文件。
dd if=/dev/zero of=txt4.txt bs=1M count=10 往一个文件写入多少内存的命令
cat txt3.txt >> passwd 追加一个文件到另一个文件的命令,不覆盖
[root@master data]# find /data -size +10M
/data/txt3.txt
/data/passwd
[root@master data]# find /data -size 10M
/data/txt4.txt
[root@master data]# find /data -size -1M
/data/test1.txt
/data/test2.txt
/data/test3.txt
/data/test4.txt
/data/test5.txt
/data/test6.txt
/data/test7.txt
/data/test8.txt
/data/test9.txt
/data/test10.txt
/data/test11.txt
/data/test12.txt
/data/test13.txt
/data/test14.txt
/data/test15.txt
/data/test16.txt
/data/test17.txt
/data/test18.txt
/data/test19.txt
/data/test20.txt
/data/test21.txt
/data/test22.txt
/data/test23.txt
/data/test24.txt
/data/test25.txt
/data/test26.txt
/data/test27.txt
/data/test28.txt
/data/test29.txt
/data/test30.txt
/data/test31.txt
/data/test32.txt
/data/test33.txt
/data/test34.txt
/data/test35.txt
/data/test36.txt
/data/test37.txt
/data/test38.txt
/data/test39.txt
/data/test40.txt
/data/txt1.txt
/data/txt2.txt
/data/txt5.txt
/data/txt6.txt
/data/txt7.txt
/data/txt8.txt
/data/txt9.txt
/data/txt10.txt
/data/txt
/data/A
/data/B
/data/C
/data/D
/data/E
/data/F
/data/G
/data/H
/data/I
/data/J
/data/K
/data/L
/data/M
/data/N
/data/O
/data/P
/data/Q
/data/R
/data/S
/data/T
/data/U
/data/V
/data/W
/data/X
/data/Y
/data/Z
/data/test
(4)find工具perm参数案例,详解如下:
find /data -perm 755:查找/data/目录权限为755的文件或者目录
find/data -perm -007:与perm77相同,表示所有权限。
find/data -perm +644:查找文件权限符号为644以上的文件
[root@master data]# find /data -perm 755
/data
[root@master data]# find /data -perm -007
[root@master data]# find /data -type f |xargs chmod 007 -R
[root@master data]# find /data -perm -007
/data/test.txt
/data/test1.txt
/data/test2.txt
/data/test3.txt
/data/test4.txt
/data/test5.txt
/data/test6.txt
/data/test7.txt
/data/test8.txt
/data/test9.txt
/data/test10.txt
/data/test11.txt
/data/test12.txt
/data/test13.txt
/data/test14.txt
/data/test15.txt
/data/test16.txt
/data/test17.txt
/data/test18.txt
/data/test19.txt
/data/test20.txt
/data/test21.txt
/data/test22.txt
/data/test23.txt
/data/test24.txt
/data/test25.txt
/data/test26.txt
/data/test27.txt
/data/test28.txt
/data/test29.txt
/data/test30.txt
/data/test31.txt
/data/test32.txt
/data/test33.txt
/data/test34.txt
/data/test35.txt
/data/test36.txt
/data/test37.txt
/data/test38.txt
/data/test39.txt
/data/test40.txt
/data/txt1.txt
/data/txt2.txt
/data/txt4.txt
/data/txt5.txt
/data/txt6.txt
/data/txt7.txt
/data/txt8.txt
/data/txt9.txt
/data/txt10.txt
/data/txt
/data/A
/data/B
/data/C
/data/D
/data/E
/data/F
/data/G
/data/H
/data/I
/data/J
/data/K
/data/L
/data/M
/data/N
/data/O
/data/P
/data/Q
/data/R
/data/S
/data/T
/data/U
/data/V
/data/W
/data/X
/data/Y
/data/Z
/data/test
/data/txt3.txt
/data/passwd
[root@master data]# find /data -type f |xargs chmod 644 -R
[root@master data]# find /data -perm +644
/data/test.txt
/data/test1.txt
/data/test2.txt
/data/test3.txt
/data/test4.txt
/data/test5.txt
/data/test6.txt
/data/test7.txt
/data/test8.txt
/data/test9.txt
/data/test10.txt
/data/test11.txt
/data/test12.txt
/data/test13.txt
/data/test14.txt
/data/test15.txt
/data/test16.txt
/data/test17.txt
/data/test18.txt
/data/test19.txt
/data/test20.txt
/data/test21.txt
/data/test22.txt
/data/test23.txt
/data/test24.txt
/data/test25.txt
/data/test26.txt
/data/test27.txt
/data/test28.txt
/data/test29.txt
/data/test30.txt
/data/test31.txt
/data/test32.txt
/data/test33.txt
/data/test34.txt
/data/test35.txt
/data/test36.txt
/data/test37.txt
/data/test38.txt
/data/test39.txt
/data/test40.txt
/data/txt1.txt
/data/txt2.txt
/data/txt4.txt
/data/txt5.txt
/data/txt6.txt
/data/txt7.txt
/data/txt8.txt
/data/txt9.txt
/data/txt10.txt
/data/txt
/data/A
/data/B
/data/C
/data/D
/data/E
/data/F
/data/G
/data/H
/data/I
/data/J
/data/K
/data/L
/data/M
/data/N
/data/O
/data/P
/data/Q
/data/R
/data/S
/data/T
/data/U
/data/V
/data/W
/data/X
/data/Y
/data/Z
/data/test
/data/txt3.txt
/data/passwd
(5)find工具mime参数案例,详解如下
atime, access time:文件被读取或者执行的时间
ctime, change time:文件状态改变时间
mime, modify time:文件内容被修改的时间
Find /data -mtime +30 -name “.log":查找30天以前的log文件
Find /data -mtime -30 -name ““.txt”:查找30天以内的log文件
Find /data -mtime +30 -name " .txt":查找第30天的log文件
find /data -mmin +30 -name ".log”:查找30min以前被访问的log文件
find /data -amin -30 -name ".log”:查找30min以内被访问的log文件
find /data -cmin 30 -name ".log”:查找第30min改变的log文件
[root@master data]# find /data -mtime +30 -name ".log"
[root@master data]# find /data -mtime -30 -name ".txt"
[root@master data]# find /data -mtime +30 -name ".txt"
[root@master data]# find /data -mmin +30 -name ".log"
[root@master data]# find /data -amin -30 -name ".log"
[root@master data]# find /data -cmin 30 -name ".log"
(6)find工具参数综合案例,代码如下
查找/data目录以,.log结尾,文件大于10KB的文件,同时/cp到/tmp目录
find /data/ -name ". log’ -type f -size +10k -exec cp {} /tmp/ ;
查我/ata目录以结尾,文件大于10EB的文件,权限为644并别除该文件
find /data/ -name ".log” -type f -size 10k -m perm 644 -exec rm -rf {} ;
查找/ta目录以,1q结尾,30天以前的文件,大小大于10并移动到/tmp目录
find /data/ -name " . log” -type f -mtine +30 -size +10M -exec mv { } /temp/
xargs:
1. 查找 `/data` 目录下以 `.log` 结尾、文件大小大于10KB的文件,并复制到 `/tmp` 目录:
```bash
find /data/ -name "*.log" -type f -size +10k -exec cp {} /tmp/ \;
注意:在 -name
参数中,您需要使用双引号 "*.log"
来匹配所有以 .log
结尾的文件名。
查找
/data
目录下以.log
结尾、文件大小大于10EB(通常这个条件不太可能应用)且权限为644的文件,并删除这些文件。这里假设您是想查找大于10KB的文件,且其权限必须为644:find /data/ -name "*.log" -type f \( -size +10k -a -perm 644 \) -exec rm -f {} \;
注:-rf 选项可能会递归删除包含文件的目录,如果只需要删除文件,建议使用
-f
选项。查找
/data
目录下以.log
结尾、修改时间在30天以前、并且文件大小大于10MB的文件,并移动到/temp
目录(这里假设您是想写/tmp
目录):find /data/ -name "*.log" -type f -mtime +30 -size +10M -exec mv {} /tmp/ \;
注:请确保路径
/tmp
的正确性以及mv
命令后有反斜杠\;
来结束-exec
参数。同时,请根据实际情况调整文件大小单位,例如此处已更正为 MB (+10M
) 而不是之前未知的单位。[root@master data]# find /data/ -name ".log" -type f -size +10k -exec cp {} /tmp/ ;
[root@master data]# cd /tmp
[root@master tmp]# ls
10.log 14.log 1.log 3.txt 6.txt 9.txt
10.txt 15.log 1.txt 4.log 7.log acclog.log
{1.10}.txt 16.log 20.log 4.txt 7.txt yum_save_tx.2024-03-09.20-43.MjeG_P.yumtx
11.log 17.log 2.log 5.log 8.log
12.log 18.log 2.txt 5.txt 8.txt
13.log 19.log 3.log 6.log 9.log
[root@master tmp]# find /data/ -name ".log" -type f ( -size +10k -a -perm 644 ) -exec rm -f {} ;
[root@master tmp]# cd /data
[root@master data]# ls
10.log 2.log E passwd test16.txt test27.txt test38.txt txt10.txt W
11.log 3.log F Q test17.txt test28.txt test39.txt txt1.txt X
12.log 4.log G R test18.txt test29.txt test3.txt txt2.txt Y
13.log 5.log H S test19.txt test2.txt test40.txt txt3.txt Z
14.log 6.log I T test1.txt test30.txt test4.txt txt4.txt
15.log 7.log J test test20.txt test31.txt test5.txt txt5.txt
16.log 8.log K test10.txt test21.txt test32.txt test6.txt txt6.txt
17.log 9.log L test11.txt test22.txt test33.txt test7.txt txt7.txt
18.log A M test12.txt test23.txt test34.txt test8.txt txt8.txt
19.log B N test13.txt test24.txt test35.txt test9.txt txt9.txt
1.log C O test14.txt test25.txt test36.txt test.txt U
20.log D P test15.txt test26.txt test37.txt txt V
[root@master data]# find /data/ -name "*.log" -type f -mtime +30 -size +10M -exec mv {} /tmp/ ;
[root@master data]# ls
10.log 2.log E passwd test16.txt test27.txt test38.txt txt10.txt W
11.log 3.log F Q test17.txt test28.txt test39.txt txt1.txt X
12.log 4.log G R test18.txt test29.txt test3.txt txt2.txt Y
13.log 5.log H S test19.txt test2.txt test40.txt txt3.txt Z
14.log 6.log I T test1.txt test30.txt test4.txt txt4.txt
15.log 7.log J test test20.txt test31.txt test5.txt txt5.txt
16.log 8.log K test10.txt test21.txt test32.txt test6.txt txt6.txt
17.log 9.log L test11.txt test22.txt test33.txt test7.txt txt7.txt
18.log A M test12.txt test23.txt test34.txt test8.txt txt8.txt
19.log B N test13.txt test24.txt test35.txt test9.txt txt9.txt
1.log C O test14.txt test25.txt test36.txt test.txt U
20.log D P test15.txt test26.txt test37.txt txt V
###### 4)井号符号 #
1.表示文件内容注释符号
2.表示用户命令提示符号
超级用户为 #
普通用户为 $
(二)引号符号系列
1.美元括号:
$()
表示命令执行结果留下,用于其他命令调用
2.引号符号:
双引号
""
表示输入内容,就是输出内容,但是部分信息会被解析
单引号
''
表示输入内容,就是输出内容(所见即所得)
反引号
``
表示命令执行结果留下,用于其他命令调用
(三)定向符号系列
1.小于符号:
单个小于符号
<
标准输入重定向符号
两个小于符号
<<
标准输入追加重定向符号
2.大于符号:
单个大于符号
\>
标准输出重定向符号
错误输出重定向符号
两个大于符号
\>>
标准输出追加重定向符号
错误输出追加重定向符号
(四)路径符号系列
1.单点符号:
.
表示当前目录
2.双点符号:
..
表示上级目录
3.波浪符号
~
表示用户家目录信息
超级用户:/root
普通用户:/home/用户名称
(五)逻辑符号系列
1.并且符号:
&&
表示前面的名称执行成功,再执行后面的命令
2.或者符号:
||
表示前面的名称执行失败,再执行后面的命令
#### 二、常见通配符号
作用说明:查找文件名称信息
使用场景:命令行经常使用
(一)通配符号作用
通配符号作用说明:方便匹配找出多个数据文件(按照文件名称进行匹配查找)
(二)通配符号企业应用
通配符号企业应用(wildcard)
1.星号:*
表示匹配所有内容信息
\# 找出以什么结尾的文件信息
find /test -type f -name "*.txt"
\# 找出以什么开头的文件信息
find /test -type f -name "test*"
2.花括号:{}
表示生成序列信息
\# 生成连续数字序列
echo {01..10}
\# 生成不连续数字序列
echo {01,03,05}
\# 生成连续字母序列
echo {a..d}
\# 生成不连续字母序列
echo {a,d,f,h}
表示生成组合序列
\# 生成组合序列
echo A{A,B}
\# 生成组合序列
echo {A,B}{C,D}
\# 生成备份文件
cp oldboy.txt{,.bak}
#### 三、find(以文件为单位进行查找后删除复制移动)
find:查找符合条件的文件
01、精确查找:
find 路径信息 -type 文件类型 -name "文件名"
02、模糊查找:
find 路径信息 -type 文件类型 -name "文件名*"
find 路径信息 -type 文件类型 -name "*文件名"
find 路径信息 -type 文件类型 -name "文*件名"
03、忽略字符大小写查找:
find 路径信息 -type 文件类型 -iname "文件名*"
04、根据数据大小查找数据:
find /test -type f -size +100 --找出大于100k的文件
find /test -type f -size -100 --找出小于100k的文件
find /test -type f -size +1M --找出大于1M的文件
`b' for 512-byte blocks (this is the default if no suffix is used)
`c' for bytes (推荐)
`w' for two-byte words
`k' for Kilobytes (units of 1024 bytes) (推荐)
`M' for Megabytes (units of 1048576 bytes) (推荐)
`G' for Gigabytes (units of 1073741824 bytes)
05、根据目录指定层级进行查找数据(进行递归查找):
find /test -maxdepth 1 -type f -name "test*"
06、实际应用:
1. 如何找出/test/目录中.txt结尾的文件,将找出的文件进行统一删除
a find /test/ -maxdepth 1 -type f -name "*.txt" -delete
b find /test/ -type f -name "*.txt" -exec rm -rf {} \;
c find /test/ -type f -name "*.txt" | xargs rm -f
d rm -rf $(find /test -type f -name "*.txt")
e rm -f `find /test/ -type f -name "*.txt"`
[root@master test]# touch test{1..20}.txt
[root@master test]# ls
test10.txt test13.txt test16.txt test19.txt test2.txt test5.txt test8.txt
test11.txt test14.txt test17.txt test1.txt test3.txt test6.txt test9.txt
test12.txt test15.txt test18.txt test20.txt test4.txt test7.txt
[root@master test]# find /test/ -maxdepth 1 -type f -name "*txt" -delete
[root@master test]# ls
[root@master test]#
[root@master test]# touch test{1..20}.txt
[root@master test]# ls
test10.txt test13.txt test16.txt test19.txt test2.txt test5.txt test8.txt
test11.txt test14.txt test17.txt test1.txt test3.txt test6.txt test9.txt
test12.txt test15.txt test18.txt test20.txt test4.txt test7.txt
[root@master test]# find /test/ -type f -name "*.txt" -exec rm -rf {} ;
[root@master test]# ls
[root@master test]#
[root@master test]# ls
test10.txt test13.txt test16.txt test19.txt test2.txt test5.txt test8.txt
test11.txt test14.txt test17.txt test1.txt test3.txt test6.txt test9.txt
test12.txt test15.txt test18.txt test20.txt test4.txt test7.txt
[root@master test]# find /test/ -type f -name "*.txt" |xargs rm -f
[root@master test]# ls
[root@master test]#
[root@master test]# rm -rf $(find /test -type f -name "*txt")
[root@master test]# ls
02.如何找出/test/目录中.txt结尾的文件,将找出的文件进行批量复制/移动到/tmp目录中
find /test/ -maxdepth 1 -type f -name "*.txt" -exec cp {} /tmp \;
find /test/ -maxdepth 1 -type f -name "*.txt"|xargs -I{} cp -t /tmp {} ---xargs其作用是将查找内容一列变为1行
[root@master test]# find /test/ -maxdepth 1 -type f -name "*.txt" -exec cp {} /tmp ;
[root@master test]# ls
test10.txt test15.txt test1.txt test24.txt test29.txt test5.txt
test11.txt test16.txt test20.txt test25.txt test2.txt test6.txt
test12.txt test17.txt test21.txt test26.txt test30.txt test7.txt
test13.txt test18.txt test22.txt test27.txt test3.txt test8.txt
test14.txt test19.txt test23.txt test28.txt test4.txt test9.txt
[root@master test]# cd /tmp
[root@master tmp]# ls
10.log 1.txt 7.txt test17.txt test29.txt
10.txt 20.log 8.log test18.txt test2.txt
{1.10}.txt 2.log 8.txt test19.txt test30.txt
11.log 2.txt 9.log test1.txt test3.txt
12.log 3.log 9.txt test20.txt test4.txt
13.log 3.txt acclog.log test21.txt test5.txt
14.log 4.log test10.txt test22.txt test6.txt
15.log 4.txt test11.txt test23.txt test7.txt
16.log 5.log test12.txt test24.txt test8.txt
17.log 5.txt test13.txt test25.txt test9.txt
18.log 6.log test14.txt test26.txt yum_save_tx.2024-03-09.20-43.MjeG_P.yumtx
19.log 6.txt test15.txt test27.txt
1.log 7.log test16.txt test28.txt
[root@master tmp]# find /test/ -maxdepth 1 -type f -name "*.txt"|xargs -I{} cp -t /tmp {}
[root@master tmp]# ls
10.log 1.txt 7.txt test17.txt test29.txt
10.txt 20.log 8.log test18.txt test2.txt
{1.10}.txt 2.log 8.txt test19.txt test30.txt
11.log 2.txt 9.log test1.txt test3.txt
12.log 3.log 9.txt test20.txt test4.txt
13.log 3.txt acclog.log test21.txt test5.txt
14.log 4.log test10.txt test22.txt test6.txt
15.log 4.txt test11.txt test23.txt test7.txt
16.log 5.log test12.txt test24.txt test8.txt
17.log 5.txt test13.txt test25.txt test9.txt
18.log 6.log test14.txt test26.txt yum_save_tx.2024-03-09.20-43.MjeG_P.yumtx
19.log 6.txt test15.txt test27.txt
1.log 7.log test16.txt test28.txt
补充:
###### 1.查找指定数据信息进行删除
01.find /test -type f -name "test*.txt"|xargs rm
02.find /test -type f -name "test*.txt" -exec rm -rf {} \;
03.find /test -type f -name "test*.txt" -delete
[root@master tmp]# find /test -type f -name "test*.txt"|xargs rm
[root@master tmp]# cd /test
[root@master test]# ls
[root@master test]# touch test{1..90}.txt
[root@master test]# ls
test10.txt test22.txt test34.txt test46.txt test58.txt test6.txt test81.txt
test11.txt test23.txt test35.txt test47.txt test59.txt test70.txt test82.txt
test12.txt test24.txt test36.txt test48.txt test5.txt test71.txt test83.txt
test13.txt test25.txt test37.txt test49.txt test60.txt test72.txt test84.txt
test14.txt test26.txt test38.txt test4.txt test61.txt test73.txt test85.txt
test15.txt test27.txt test39.txt test50.txt test62.txt test74.txt test86.txt
test16.txt test28.txt test3.txt test51.txt test63.txt test75.txt test87.txt
test17.txt test29.txt test40.txt test52.txt test64.txt test76.txt test88.txt
test18.txt test2.txt test41.txt test53.txt test65.txt test77.txt test89.txt
test19.txt test30.txt test42.txt test54.txt test66.txt test78.txt test8.txt
test1.txt test31.txt test43.txt test55.txt test67.txt test79.txt test90.txt
test20.txt test32.txt test44.txt test56.txt test68.txt test7.txt test9.txt
test21.txt test33.txt test45.txt test57.txt test69.txt test80.txt
[root@master test]# find /test -type f -name "test*.txt" -exec rm -rf {} ;
[root@master test]# ls
[root@master test]#
[root@master test]# touch test{1..90}.txt
[root@master test]# ls
test10.txt test22.txt test34.txt test46.txt test58.txt test6.txt test81.txt
test11.txt test23.txt test35.txt test47.txt test59.txt test70.txt test82.txt
test12.txt test24.txt test36.txt test48.txt test5.txt test71.txt test83.txt
test13.txt test25.txt test37.txt test49.txt test60.txt test72.txt test84.txt
test14.txt test26.txt test38.txt test4.txt test61.txt test73.txt test85.txt
test15.txt test27.txt test39.txt test50.txt test62.txt test74.txt test86.txt
test16.txt test28.txt test3.txt test51.txt test63.txt test75.txt test87.txt
test17.txt test29.txt test40.txt test52.txt test64.txt test76.txt test88.txt
test18.txt test2.txt test41.txt test53.txt test65.txt test77.txt test89.txt
test19.txt test30.txt test42.txt test54.txt test66.txt test78.txt test8.txt
test1.txt test31.txt test43.txt test55.txt test67.txt test79.txt test90.txt
test20.txt test32.txt test44.txt test56.txt test68.txt test7.txt test9.txt
test21.txt test33.txt test45.txt test57.txt test69.txt test80.txt
[root@master test]# find /test -type f -name "test*.txt" -delete
[root@master test]# ls
[root@master test]#
###### 2.查找指定数据信息进行复制
01.find /test -type f -name "test*.txt"|xargs -i cp {} /test01/
02.find /test -type f -name "test*.txt"|xargs cp -t /test01/
03.find /test -type f -name "test*.txt" -exec cp -a {} /test01 \;
[root@master test01]# ls
test10.txt test15.txt test1.txt test24.txt test29.txt test5.txt test.txt
test11.txt test16.txt test20.txt test25.txt test2.txt test6.txt
test12.txt test17.txt test21.txt test26.txt test30.txt test7.txt
test13.txt test18.txt test22.txt test27.txt test3.txt test8.txt
test14.txt test19.txt test23.txt test28.txt test4.txt test9.txt
[root@master test01]# find /test -type f -name "test*.txt" |xargs -i cp {} /test01/
[root@master test01]# ls
test10.txt test22.txt test34.txt test46.txt test58.txt test6.txt test81.txt
test11.txt test23.txt test35.txt test47.txt test59.txt test70.txt test82.txt
test12.txt test24.txt test36.txt test48.txt test5.txt test71.txt test83.txt
test13.txt test25.txt test37.txt test49.txt test60.txt test72.txt test84.txt
test14.txt test26.txt test38.txt test4.txt test61.txt test73.txt test85.txt
test15.txt test27.txt test39.txt test50.txt test62.txt test74.txt test86.txt
test16.txt test28.txt test3.txt test51.txt test63.txt test75.txt test87.txt
test17.txt test29.txt test40.txt test52.txt test64.txt test76.txt test88.txt
test18.txt test2.txt test41.txt test53.txt test65.txt test77.txt test89.txt
test19.txt test30.txt test42.txt test54.txt test66.txt test78.txt test8.txt
test1.txt test31.txt test43.txt test55.txt test67.txt test79.txt test90.txt
test20.txt test32.txt test44.txt test56.txt test68.txt test7.txt test9.txt
test21.txt test33.txt test45.txt test57.txt test69.txt test80.txt test.txt
[root@master test01]# find /test -type f -name "test.txt" |xargs cp -t /test01/
[root@master test01]# ls
test10.txt test22.txt test34.txt test46.txt test58.txt test6.txt test81.txt
test11.txt test23.txt test35.txt test47.txt test59.txt test70.txt test82.txt
test12.txt test24.txt test36.txt test48.txt test5.txt test71.txt test83.txt
test13.txt test25.txt test37.txt test49.txt test60.txt test72.txt test84.txt
test14.txt test26.txt test38.txt test4.txt test61.txt test73.txt test85.txt
test15.txt test27.txt test39.txt test50.txt test62.txt test74.txt test86.txt
test16.txt test28.txt test3.txt test51.txt test63.txt test75.txt test87.txt
test17.txt test29.txt test40.txt test52.txt test64.txt test76.txt test88.txt
test18.txt test2.txt test41.txt test53.txt test65.txt test77.txt test89.txt
test19.txt test30.txt test42.txt test54.txt test66.txt test78.txt test8.txt
test1.txt test31.txt test43.txt test55.txt test67.txt test79.txt test90.txt
test20.txt test32.txt test44.txt test56.txt test68.txt test7.txt test9.txt
test21.txt test33.txt test45.txt test57.txt test69.txt test80.txt test.txt
[root@master test01]# find /test -type f -name "test.txt" -exec cp -a {} /test01 ;
[root@master test01]# ls
test10.txt test22.txt test34.txt test46.txt test58.txt test6.txt test81.txt
test11.txt test23.txt test35.txt test47.txt test59.txt test70.txt test82.txt
test12.txt test24.txt test36.txt test48.txt test5.txt test71.txt test83.txt
test13.txt test25.txt test37.txt test49.txt test60.txt test72.txt test84.txt
test14.txt test26.txt test38.txt test4.txt test61.txt test73.txt test85.txt
test15.txt test27.txt test39.txt test50.txt test62.txt test74.txt test86.txt
test16.txt test28.txt test3.txt test51.txt test63.txt test75.txt test87.txt
test17.txt test29.txt test40.txt test52.txt test64.txt test76.txt test88.txt
test18.txt test2.txt test41.txt test53.txt test65.txt test77.txt test89.txt
test19.txt test30.txt test42.txt test54.txt test66.txt test78.txt test8.txt
test1.txt test31.txt test43.txt test55.txt test67.txt test79.txt test90.txt
test20.txt test32.txt test44.txt test56.txt test68.txt test7.txt test9.txt
test21.txt test33.txt test45.txt test57.txt test69.txt test80.txt test.txt
###### 3.查找指定数据信息进行移动
01.find /test -type f -name "test*.txt"|xargs -i mv {} /test01/
02.find /test -type f -name "test*.txt"|xargs mv -t /test01/
03.find /test -type f -name "test*.txt" -exec mv {} /test01 \;
[root@master test]# find /test -type f -name "test*.txt"|xargs -i mv {} /test01/
[root@master test]# ls
nwq10.txt nwq2.txt nwq4.txt nwq6.txt nwq8.txt
nwq1.txt nwq3.txt nwq5.txt nwq7.txt nwq9.txt
[root@master test]# touch test{110..180}.txt
[root@master test]# find /test -type f -name "test.txt"|xargs mv -t /test01/
[root@master test]# ls
nwq10.txt nwq2.txt nwq4.txt nwq6.txt nwq8.txt
nwq1.txt nwq3.txt nwq5.txt nwq7.txt nwq9.txt
[root@master test]# touch test{110..200}.txt
[root@master test]# ls
nwq10.txt test115.txt test130.txt test145.txt test160.txt test175.txt test190.txt
nwq1.txt test116.txt test131.txt test146.txt test161.txt test176.txt test191.txt
nwq2.txt test117.txt test132.txt test147.txt test162.txt test177.txt test192.txt
nwq3.txt test118.txt test133.txt test148.txt test163.txt test178.txt test193.txt
nwq4.txt test119.txt test134.txt test149.txt test164.txt test179.txt test194.txt
nwq5.txt test120.txt test135.txt test150.txt test165.txt test180.txt test195.txt
nwq6.txt test121.txt test136.txt test151.txt test166.txt test181.txt test196.txt
nwq7.txt test122.txt test137.txt test152.txt test167.txt test182.txt test197.txt
nwq8.txt test123.txt test138.txt test153.txt test168.txt test183.txt test198.txt
nwq9.txt test124.txt test139.txt test154.txt test169.txt test184.txt test199.txt
test110.txt test125.txt test140.txt test155.txt test170.txt test185.txt test200.txt
test111.txt test126.txt test141.txt test156.txt test171.txt test186.txt
test112.txt test127.txt test142.txt test157.txt test172.txt test187.txt
test113.txt test128.txt test143.txt test158.txt test173.txt test188.txt
test114.txt test129.txt test144.txt test159.txt test174.txt test189.txt
[root@master test]# find /test -type f -name "test.txt" -exec mv {} /test01 ;
[root@master test]# ls
nwq10.txt nwq2.txt nwq4.txt nwq6.txt nwq8.txt
nwq1.txt nwq3.txt nwq5.txt nwq7.txt nwq9.txt
###### 4.查找指定数据信息按照日期(主要用于批量删除历史数据信息)
01.查找7天以前的数据:find /test -type f -mtime +7
02.查找最近7天的数据:find /test -type f -mtime -7
03.查找距今第7天数据:find /test -type f -mtime 7
/usr/share/xml/fontconfig/fonts.dtd
/usr/share/xml/iso-codes/iso_15924.xml
/usr/share/xml/iso-codes/iso_3166.xml
/usr/share/xml/iso-codes/iso_3166_2.xml
/usr/share/xml/iso-codes/iso_4217.xml
/usr/share/xml/iso-codes/iso_639.xml
/usr/share/xml/iso-codes/iso_639_3.xml
/usr/share/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd
/usr/share/xml/libglade/glade-2.0.dtd
/usr/share/fontconfig/conf.avail/20-unhint-small-dejavu-sans.conf
/usr/share/fontconfig/conf.avail/57-dejavu-sans.conf
/usr/share/fontconfig/conf.avail/10-autohint.conf
/usr/share/fontconfig/conf.avail/10-hinting-full.conf
/usr/share/fontconfig/conf.avail/10-hinting-medium.conf
/usr/share/fontconfig/conf.avail/10-hinting-none.conf
/usr/share/fontconfig/conf.avail/10-hinting-slight.conf
/usr/share/fontconfig/conf.avail/10-no-sub-pixel.conf
/usr/share/fontconfig/conf.avail/10-scale-bitmap-fonts.conf
/usr/share/fontconfig/conf.avail/10-sub-pixel-bgr.conf
/usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf
/usr/share/fontconfig/conf.avail/10-sub-pixel-vbgr.conf
/usr/share/fontconfig/conf.avail/10-sub-pixel-vrgb.conf
/usr/share/fontconfig/conf.avail/10-unhinted.conf
/usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf
/usr/share/fontconfig/conf.avail/11-lcdfilter-legacy.conf
/usr/share/fontconfig/conf.avail/11-lcdfilter-light.conf
/usr/share/fontconfig/conf.avail/20-unhint-small-vera.conf
/usr/share/fontconfig/conf.avail/25-unhint-nonlatin.conf
/usr/share/fontconfig/conf.avail/30-metric-aliases.conf
/usr/share/fontconfig/conf.avail/30-urw-aliases.conf
/usr/share/fontconfig/conf.avail/40-nonlatin.conf
/usr/share/fontconfig/conf.avail/45-generic.conf
/usr/share/fontconfig/conf.avail/45-latin.conf
/usr/share/fontconfig/conf.avail/49-sansserif.conf
/usr/share/fontconfig/conf.avail/50-user.conf
/usr/share/fontconfig/conf.avail/51-local.conf
/usr/share/fontconfig/conf.avail/60-generic.conf
/usr/share/fontconfig/conf.avail/60-latin.conf
/usr/share/fontconfig/conf.avail/65-fonts-persian.conf
/usr/share/fontconfig/conf.avail/65-khmer.conf
/usr/share/fontconfig/conf.avail/65-nonlatin.conf
/usr/share/fontconfig/conf.avail/69-unifont.conf
/usr/share/fontconfig/conf.avail/70-no-bitmaps.conf
/usr/share/fontconfig/conf.avail/70-yes-bitmaps.conf
/usr/share/fontconfig/conf.avail/80-delicious.conf
/usr/share/fontconfig/conf.avail/90-synthetic.conf
/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf
/usr/share/fonts/dejavu/DejaVuSans-BoldOblique.ttf
/usr/share/fonts/dejavu/DejaVuSans-ExtraLight.ttf
/usr/share/fonts/dejavu/DejaVuSans-Oblique.ttf
/usr/share/fonts/dejavu/DejaVuSans.ttf
/usr/share/fonts/dejavu/DejaVuSansCondensed-Bold.ttf
/usr/share/fonts/dejavu/DejaVuSansCondensed-BoldOblique.ttf
/usr/share/fonts/dejavu/DejaVuSansCondensed-Oblique.ttf
/usr/share/fonts/dejavu/DejaVuSansCondensed.ttf
/usr/share/enchant/enchant.ordering
/usr/share/help/rarian.document
/usr/share/librarian/Templates/C/scrollkeeper_cl.xml
/usr/share/librarian/manual/help-spec-0.2.xml
/usr/share/librarian/manual/index.xhtml
/usr/share/librarian/manual/rar-lib.xhtml
/usr/share/librarian/manual/rar-mdf.xhtml
/usr/share/librarian/manual/rar-skcompat.xhtml
/usr/share/librarian/rarian-sk-cl.xml
/usr/share/libthai/thbrk.tri
/usr/share/system-config-keyboard/keyboard_cli.py
/usr/share/system-config-keyboard/keyboard_gui.py
/usr/share/system-config-keyboard/keyboard_tui.py
/usr/share/system-config-keyboard/pixmaps/system-config-keyboard.png
/usr/share/system-config-keyboard/system-config-keyboard.py
/usr/share/system-config-keyboard/keyboard_cli.pyc
/usr/share/system-config-keyboard/keyboard_cli.pyo
/usr/share/system-config-keyboard/keyboard_gui.pyc
/usr/share/system-config-keyboard/keyboard_gui.pyo
/usr/share/system-config-keyboard/keyboard_tui.pyc
/usr/share/system-config-keyboard/keyboard_tui.pyo
/usr/share/system-config-keyboard/system-config-keyboard.pyc
/usr/share/system-config-keyboard/system-config-keyboard.pyo
/usr/share/yelp-xsl/js/highlight.pack.js
/usr/share/yelp-xsl/xslt/common/color.xsl
/usr/share/yelp-xsl/xslt/common/domains/yelp-xsl.xml
/usr/share/yelp-xsl/xslt/common/domains/yelp.xml
/usr/share/yelp-xsl/xslt/common/html.xsl
/usr/share/yelp-xsl/xslt/common/icons/yelp-note-advanced.svg
/usr/share/yelp-xsl/xslt/common/icons/yelp-note-bug.svg
/usr/share/yelp-xsl/xslt/common/icons/yelp-note-important.svg
/usr/share/yelp-xsl/xslt/common/icons/yelp-note-note.svg
/usr/share/yelp-xsl/xslt/common/icons/yelp-note-package.svg
/usr/share/yelp-xsl/xslt/common/icons/yelp-note-tip.svg
/usr/share/yelp-xsl/xslt/common/icons/yelp-note-warning.svg
/usr/share/yelp-xsl/xslt/common/icons.xsl
/usr/share/yelp-xsl/xslt/common/l10n-numbers.xsl
/usr/share/yelp-xsl/xslt/common/l10n.xsl
/usr/share/yelp-xsl/xslt/common/ttml.xsl
/usr/share/yelp-xsl/xslt/common/utils.xsl
/usr/share/yelp-xsl/xslt/docbook/common/db-chunk.xsl
/usr/share/yelp-xsl/xslt/docbook/common/db-common.xsl
/usr/share/yelp-xsl/xslt/docbook/common/db-profile.xsl
/usr/share/yelp-xsl/xslt/docbook/common/db-selectors.mod
/usr/share/yelp-xsl/xslt/docbook/common/db-title.xsl
/usr/share/yelp-xsl/xslt/docbook/common/db-xref.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-bibliography.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-block.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-callout.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-classsynopsis.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-cmdsynopsis.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-css.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-division.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-ebnf.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-footnote.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-funcsynopsis.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-index.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-inline.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-links.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-list.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-math.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-media.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-refentry.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-suppressed.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-table.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html-xref.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2html.xsl
/usr/share/yelp-xsl/xslt/docbook/html/db2xhtml.xsl
/usr/share/yelp-xsl/xslt/mallard/cache/mal-cache.xsl
/usr/share/yelp-xsl/xslt/mallard/common/mal-gloss.xsl
/usr/share/yelp-xsl/xslt/mallard/common/mal-if.xsl
/usr/share/yelp-xsl/xslt/mallard/common/mal-link.xsl
/usr/share/yelp-xsl/xslt/mallard/common/mal-sort.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-api.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-block.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-gloss.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-inline.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-links.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-list.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-math.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-media.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-page.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-svg.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-table.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html-ui.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2html.xsl
/usr/share/yelp-xsl/xslt/mallard/html/mal2xhtml.xsl
/usr/share/thumbnailers/gdk-pixbuf-thumbnailer.thumbnailer
/usr/share/thumbnailers/librsvg.thumbnailer
/usr/share/defaults/at-spi2/accessibility.conf
/usr/share/appdata/gstreamer-base.appdata.xml
/usr/share/appdata/gstreamer-bad-free.appdata.xml
/usr/share/gstreamer-1.0/presets/GstFreeverb.prs
/usr/share/pygtk/2.0/defs/canvas.defs
/usr/share/usermode/usermode.ui
/usr/share/system-config-language/gui_detailsDialog.py
/usr/share/system-config-language/gui_errors.py
/usr/share/system-config-language/gui_install.py
/usr/share/system-config-language/gui_progress.py
/usr/share/system-config-language/lang_dict.py
/usr/share/system-config-language/language_backend.py
/usr/share/system-config-language/language_gui.py
/usr/share/system-config-language/language_tui.py
/usr/share/system-config-language/locale-list
/usr/share/system-config-language/system-config-language
/usr/share/system-config-language/system-config-language.py
/usr/share/system-config-language/tui_install.py
/usr/share/system-config-language/yumhelpers.glade
/usr/share/system-config-language/gui_detailsDialog.pyc
/usr/share/system-config-language/gui_detailsDialog.pyo
/usr/share/system-config-language/gui_errors.pyc
/usr/share/system-config-language/gui_errors.pyo
/usr/share/system-config-language/gui_install.pyc
/usr/share/system-config-language/gui_install.pyo
/usr/share/system-config-language/gui_progress.pyc
/usr/share/system-config-language/gui_progress.pyo
/usr/share/system-config-language/lang_dict.pyc
/usr/share/system-config-language/lang_dict.pyo
/usr/share/system-config-language/language_backend.pyc
/usr/share/system-config-language/language_backend.pyo
/usr/share/system-config-language/language_gui.pyc
/usr/share/system-config-language/language_gui.pyo
/usr/share/system-config-language/language_tui.pyc
/usr/share/system-config-language/language_tui.pyo
/usr/share/system-config-language/system-config-language.pyc
/usr/share/system-config-language/system-config-language.pyo
/usr/share/system-config-language/tui_install.pyc
/usr/share/system-config-language/tui_install.pyo
/usr/share/metainfo/yelp.appdata.xml
/usr/share/yelp/dtd/catalog
/usr/share/yelp/dtd/docbookx.dtd
/usr/share/yelp/dtd/isoamsa.ent
/usr/share/yelp/dtd/isoamsb.ent
/usr/share/yelp/dtd/isoamsc.ent
/usr/share/yelp/dtd/isoamsn.ent
/usr/share/yelp/dtd/isoamso.ent
/usr/share/yelp/dtd/isoamsr.ent
/usr/share/yelp/dtd/isobox.ent
/usr/share/yelp/dtd/isocyr1.ent
/usr/share/yelp/dtd/isocyr2.ent
/usr/share/yelp/dtd/isodia.ent
/usr/share/yelp/dtd/isogrk1.ent
/usr/share/yelp/dtd/isogrk2.ent
/usr/share/yelp/dtd/isogrk3.ent
/usr/share/yelp/dtd/isogrk4.ent
/usr/share/yelp/dtd/isolat1.ent
/usr/share/yelp/dtd/isolat2.ent
/usr/share/yelp/dtd/isonum.ent
/usr/share/yelp/dtd/isopub.ent
/usr/share/yelp/dtd/isotech.ent
/usr/share/yelp/icons/hicolor/16x16/status/bookmark.png
/usr/share/yelp/icons/hicolor/16x16/status/yelp-page-task.png
/usr/share/yelp/icons/hicolor/16x16/status/yelp-page-tip.png
/usr/share/yelp/icons/hicolor/16x16/status/yelp-page-ui.png
/usr/share/yelp/icons/hicolor/16x16/status/yelp-page-video.png
/usr/share/yelp/icons/hicolor/scalable/status/yelp-page-problem-symbolic.svg
/usr/share/yelp/icons/hicolor/scalable/status/yelp-page-search-symbolic.svg
/usr/share/yelp/icons/hicolor/scalable/status/yelp-page-symbolic.svg
/usr/share/yelp/icons/hicolor/scalable/status/yelp-page-task-symbolic.svg
/usr/share/yelp/icons/hicolor/scalable/status/yelp-page-tip-symbolic.svg
/usr/share/yelp/icons/hicolor/scalable/status/yelp-page-ui-symbolic.svg
/usr/share/yelp/icons/hicolor/scalable/status/yelp-page-video-symbolic.svg
/usr/share/yelp/mathjax/MathJax.js
/usr/share/yelp/mathjax/config/MMLorHTML.js
/usr/share/yelp/mathjax/config/yelp.js
/usr/share/yelp/mathjax/extensions/HTML-CSS/handle-floats.js
/usr/share/yelp/mathjax/extensions/MathEvents.js
/usr/share/yelp/mathjax/extensions/MathMenu.js
/usr/share/yelp/mathjax/extensions/MathZoom.js
/usr/share/yelp/mathjax/extensions/mml2jax.js
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_AMS-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Bold.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Bold.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Bold.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Italic.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-BoldItalic.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Italic.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Bold.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Italic.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Script-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size1-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size2-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size3-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size4-Regular.woff
/usr/share/yelp/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Typewriter-Regular.woff
/usr/share/yelp/mathjax/jax/element/mml/jax.js
/usr/share/yelp/mathjax/jax/element/mml/optable/Arrows.js
/usr/share/yelp/mathjax/jax/element/mml/optable/BasicLatin.js
/usr/share/yelp/mathjax/jax/element/mml/optable/CombDiacritMarks.js
/usr/share/yelp/mathjax/jax/element/mml/optable/CombDiactForSymbols.js
/usr/share/yelp/mathjax/jax/element/mml/optable/Dingbats.js
/usr/share/yelp/mathjax/jax/element/mml/optable/GeneralPunctuation.js
/usr/share/yelp/mathjax/jax/element/mml/optable/GeometricShapes.js
/usr/share/yelp/mathjax/jax/element/mml/optable/GreekAndCoptic.js
/usr/share/yelp/mathjax/jax/element/mml/optable/Latin1Supplement.js
/usr/share/yelp/mathjax/jax/element/mml/optable/LetterlikeSymbols.js
/usr/share/yelp/mathjax/jax/element/mml/optable/MathOperators.js
/usr/share/yelp/mathjax/jax/element/mml/optable/MiscMathSymbolsA.js
/usr/share/yelp/mathjax/jax/element/mml/optable/MiscMathSymbolsB.js
/usr/share/yelp/mathjax/jax/element/mml/optable/MiscSymbolsAndArrows.js
/usr/share/yelp/mathjax/jax/element/mml/optable/MiscTechnical.js
/usr/share/yelp/mathjax/jax/element/mml/optable/SpacingModLetters.js
/usr/share/yelp/mathjax/jax/element/mml/optable/SuppMathOperators.js
/usr/share/yelp/mathjax/jax/element/mml/optable/SupplementalArrowsA.js
/usr/share/yelp/mathjax/jax/element/mml/optable/SupplementalArrowsB.js
/usr/share/yelp/mathjax/jax/input/MathML/config.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/a.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/b.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/c.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/d.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/e.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/f.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/fr.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/g.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/h.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/i.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/j.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/k.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/l.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/m.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/n.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/o.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/opf.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/p.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/q.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/r.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/s.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/scr.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/t.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/u.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/v.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/w.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/x.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/y.js
/usr/share/yelp/mathjax/jax/input/MathML/entities/z.js
/usr/share/yelp/mathjax/jax/input/MathML/jax.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/autoload/annotation-xml.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/autoload/maction.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/autoload/menclose.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/autoload/mglyph.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/autoload/mmultiscripts.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/autoload/ms.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/autoload/mtable.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/autoload/multiline.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/config.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/Arrows.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/BBBold.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/BoxDrawing.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/CombDiacritMarks.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/Dingbats.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/EnclosedAlphanum.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/GeneralPunctuation.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/GeometricShapes.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/GreekAndCoptic.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/Latin1Supplement.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/LatinExtendedA.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/LetterlikeSymbols.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/MathOperators.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/MiscMathSymbolsB.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/MiscSymbols.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/MiscTechnical.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/PUA.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/SpacingModLetters.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/AMS/Regular/SuppMathOperators.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Caligraphic/Bold/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Caligraphic/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Fraktur/Bold/BasicLatin.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Fraktur/Bold/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Fraktur/Bold/Other.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Fraktur/Bold/PUA.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Fraktur/Regular/BasicLatin.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Fraktur/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Fraktur/Regular/Other.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Fraktur/Regular/PUA.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Greek/Bold/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Greek/BoldItalic/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Greek/Italic/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Greek/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/Arrows.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/CombDiacritMarks.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/CombDiactForSymbols.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/GeneralPunctuation.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/GeometricShapes.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/Latin1Supplement.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/LatinExtendedA.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/LatinExtendedB.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/LetterlikeSymbols.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/MathOperators.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/MiscMathSymbolsA.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/MiscSymbols.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/MiscTechnical.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/SpacingModLetters.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/SuppMathOperators.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/SupplementalArrowsA.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Italic/CombDiacritMarks.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Italic/GeneralPunctuation.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Italic/Latin1Supplement.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Italic/LetterlikeSymbols.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Italic/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Regular/CombDiacritMarks.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Regular/GeometricShapes.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Regular/MiscSymbols.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Main/Regular/SpacingModLetters.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Math/BoldItalic/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Math/Italic/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Bold/BasicLatin.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Bold/CombDiacritMarks.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Bold/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Bold/Other.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Italic/BasicLatin.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Italic/CombDiacritMarks.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Italic/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Italic/Other.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Regular/BasicLatin.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Regular/CombDiacritMarks.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Regular/Other.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Script/Regular/BasicLatin.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Script/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Script/Regular/Other.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Size1/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Size2/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Size3/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Size4/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Typewriter/Regular/BasicLatin.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Typewriter/Regular/CombDiacritMarks.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Typewriter/Regular/Main.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/Typewriter/Regular/Other.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/fontdata-extra.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/fonts/TeX/fontdata.js
/usr/share/yelp/mathjax/jax/output/HTML-CSS/jax.js
/usr/share/yelp/mathjax/jax/output/NativeMML/config.js
/usr/share/yelp/mathjax/jax/output/NativeMML/jax.js
/usr/share/yelp/xslt/db2html.xsl
/usr/share/yelp/xslt/info2html.xsl
/usr/share/yelp/xslt/mal2html.xsl
/usr/share/yelp/xslt/man2html.xsl
/usr/share/yelp/xslt/yelp-common.xsl
/usr/share/system-config-date/date_gui.py
/usr/share/system-config-date/ntp.conf.template
/usr/share/system-config-date/pixmaps/map1440.png
/usr/share/system-config-date/scdMainWindow.py
/usr/share/system-config-date/system-config-date.glade
/usr/share/system-config-date/system-config-date.py
/usr/share/system-config-date/timezone_gui.py
/usr/share/system-config-date/timezone_map_gui.py
/usr/share/system-config-date/date_gui.pyc
/usr/share/system-config-date/date_gui.pyo
/usr/share/system-config-date/scdMainWindow.pyc
/usr/share/system-config-date/scdMainWindow.pyo
/usr/share/system-config-date/system-config-date.pyc
/usr/share/system-config-date/system-config-date.pyo
/usr/share/system-config-date/timezone_gui.pyc
/usr/share/system-config-date/timezone_gui.pyo
/usr/share/system-config-date/timezone_map_gui.pyc
/usr/share/system-config-date/timezone_map_gui.pyo
/usr/share/system-config-kickstart/GroupSelector.glade
/usr/share/system-config-kickstart/GroupSelector.py
/usr/share/system-config-kickstart/auth.py
/usr/share/system-config-kickstart/basic.py
/usr/share/system-config-kickstart/bootloader.py
/usr/share/system-config-kickstart/compssort.py
/usr/share/system-config-kickstart/firewall.py
/usr/share/system-config-kickstart/hardwareLists.py
/usr/share/system-config-kickstart/install.py
/usr/share/system-config-kickstart/kickstartGui.py
/usr/share/system-config-kickstart/network.py
/usr/share/system-config-kickstart/packages.py
/usr/share/system-config-kickstart/partEntry.py
/usr/share/system-config-kickstart/partWindow.py
/usr/share/system-config-kickstart/partition.py
/usr/share/system-config-kickstart/profileSystem.py
/usr/share/system-config-kickstart/progressWindow.py
/usr/share/system-config-kickstart/raidOptionsWindow.py
/usr/share/system-config-kickstart/raidWindow.py
/usr/share/system-config-kickstart/savedialog.py
/usr/share/system-config-kickstart/savefile.py
/usr/share/system-config-kickstart/scripts.py
/usr/share/system-config-kickstart/system-config-kickstart.glade
/usr/share/system-config-kickstart/xconfig.py
/usr/share/system-config-kickstart/progressWindow.pyc
/usr/share/system-config-kickstart/GroupSelector.pyc
/usr/share/system-config-kickstart/GroupSelector.pyo
/usr/share/system-config-kickstart/savefile.pyc
/usr/share/system-config-kickstart/auth.pyc
/usr/share/system-config-kickstart/auth.pyo
/usr/share/system-config-kickstart/savefile.pyo
/usr/share/system-config-kickstart/basic.pyc
/usr/share/system-config-kickstart/basic.pyo
/usr/share/system-config-kickstart/progressWindow.pyo
/usr/share/system-config-kickstart/bootloader.pyc
/usr/share/system-config-kickstart/bootloader.pyo
/usr/share/system-config-kickstart/savedialog.pyo
/usr/share/system-config-kickstart/compssort.pyc
/usr/share/system-config-kickstart/compssort.pyo
/usr/share/system-config-kickstart/scripts.pyo
/usr/share/system-config-kickstart/firewall.pyc
/usr/share/system-config-kickstart/firewall.pyo
/usr/share/system-config-kickstart/raidOptionsWindow.pyc
/usr/share/system-config-kickstart/hardwareLists.pyc
/usr/share/system-config-kickstart/hardwareLists.pyo
/usr/share/system-config-kickstart/scripts.pyc
/usr/share/system-config-kickstart/install.pyc
/usr/share/system-config-kickstart/install.pyo
/usr/share/system-config-kickstart/raidOptionsWindow.pyo
/usr/share/system-config-kickstart/kickstartGui.pyc
/usr/share/system-config-kickstart/kickstartGui.pyo
/usr/share/system-config-kickstart/xconfig.pyo
/usr/share/system-config-kickstart/network.pyc
/usr/share/system-config-kickstart/network.pyo
/usr/share/system-config-kickstart/xconfig.pyc
/usr/share/system-config-kickstart/packages.pyc
/usr/share/system-config-kickstart/packages.pyo
/usr/share/system-config-kickstart/raidWindow.pyc
/usr/share/system-config-kickstart/partEntry.pyc
/usr/share/system-config-kickstart/partEntry.pyo
/usr/share/system-config-kickstart/raidWindow.pyo
/usr/share/system-config-kickstart/partWindow.pyc
/usr/share/system-config-kickstart/partWindow.pyo
/usr/share/system-config-kickstart/savedialog.pyc
/usr/share/system-config-kickstart/partition.pyc
/usr/share/system-config-kickstart/partition.pyo
/usr/share/system-config-kickstart/profileSystem.pyc
/usr/share/system-config-kickstart/profileSystem.pyo
/usr/share/syslinux/altmbr.bin
/usr/share/syslinux/altmbr_c.bin
/usr/share/syslinux/altmbr_f.bin
/usr/share/syslinux/cat.c32
/usr/share/syslinux/chain.c32
/usr/share/syslinux/cmd.c32
/usr/share/syslinux/config.c32
/usr/share/syslinux/cpuid.c32
/usr/share/syslinux/vesainfo.c32
/usr/share/syslinux/cpuidtest.c32
/usr/share/syslinux/diag/geodsp1s.img.xz
/usr/share/syslinux/diag/geodspms.img.xz
/usr/share/syslinux/diag/handoff.bin
/usr/share/syslinux/disk.c32
/usr/share/syslinux/dmitest.c32
/usr/share/syslinux/dosutil/copybs.com
/usr/share/syslinux/dosutil/eltorito.sys
/usr/share/syslinux/dosutil/mdiskchk.com
/usr/share/syslinux/elf.c32
/usr/share/syslinux/ethersel.c32
/usr/share/syslinux/gfxboot.c32
/usr/share/syslinux/gptmbr.bin
/usr/share/syslinux/gptmbr_c.bin
/usr/share/syslinux/gptmbr_f.bin
/usr/share/syslinux/gpxecmd.c32
/usr/share/syslinux/gpxelinux.0
/usr/share/syslinux/gpxelinuxk.0
/usr/share/syslinux/hdt.c32
/usr/share/syslinux/host.c32
/usr/share/syslinux/ifcpu.c32
/usr/share/syslinux/ifcpu64.c32
/usr/share/syslinux/ifplop.c32
/usr/share/syslinux/int18.com
/usr/share/syslinux/isohdpfx.bin
/usr/share/syslinux/ver.com
/usr/share/syslinux/isohdpfx_c.bin
/usr/share/syslinux/isohdpfx_f.bin
/usr/share/syslinux/isohdppx.bin
/usr/share/syslinux/isohdppx_c.bin
/usr/share/syslinux/isohdppx_f.bin
/usr/share/syslinux/isolinux-debug.bin
/usr/share/syslinux/isolinux.bin
/usr/share/syslinux/kbdmap.c32
/usr/share/syslinux/linux.c32
/usr/share/syslinux/ls.c32
/usr/share/syslinux/lua.c32
/usr/share/syslinux/mboot.c32
/usr/share/syslinux/mbr.bin
/usr/share/syslinux/mbr_c.bin
/usr/share/syslinux/mbr_f.bin
/usr/share/syslinux/memdisk
/usr/share/syslinux/memdump.com
/usr/share/syslinux/meminfo.c32
/usr/share/syslinux/menu.c32
/usr/share/syslinux/pcitest.c32
/usr/share/syslinux/pmload.c32
/usr/share/syslinux/poweroff.com
/usr/share/syslinux/pwd.c32
/usr/share/syslinux/pxechain.com
/usr/share/syslinux/pxelinux.0
/usr/share/syslinux/reboot.c32
/usr/share/syslinux/rosh.c32
/usr/share/syslinux/sanboot.c32
/usr/share/syslinux/sdi.c32
/usr/share/syslinux/sysdump.c32
/usr/share/syslinux/syslinux.com
/usr/share/syslinux/syslinux.exe
/usr/share/syslinux/syslinux64.exe
/usr/share/syslinux/vesamenu.c32
/usr/share/syslinux/vpdtest.c32
/usr/share/syslinux/whichsys.c32
/usr/share/syslinux/zzjson.c32
/usr/include/python2.7/pyconfig-64.h
/usr/libexec/getconf/POSIX_V6_LP64_OFF64
/usr/libexec/getconf/POSIX_V7_LP64_OFF64
/usr/libexec/getconf/XBS5_LP64_OFF64
/usr/libexec/grepconf.sh
/usr/libexec/awk/grcat
/usr/libexec/awk/pwcat
/usr/libexec/coreutils/libstdbuf.so
/usr/libexec/openldap/create-certdb.sh
/usr/libexec/utempter/utempter
/usr/libexec/urlgrabber-ext-down
/usr/libexec/openssh/ctr-cavstest
/usr/libexec/openssh/ssh-keysign
/usr/libexec/openssh/sftp-server
/usr/libexec/openssh/ssh-pkcs11-helper
/usr/libexec/virt-what-cpuid-helper
/usr/libexec/initscripts/legacy-actions/auditd/condrestart
/usr/libexec/initscripts/legacy-actions/auditd/restart
/usr/libexec/initscripts/legacy-actions/auditd/resume
/usr/libexec/initscripts/legacy-actions/auditd/rotate
/usr/libexec/initscripts/legacy-actions/auditd/stop
/usr/libexec/initscripts/legacy-actions/httpd/configtest
/usr/libexec/initscripts/legacy-actions/httpd/graceful
/usr/libexec/initscripts/brandbot
/usr/libexec/linux-boot-probes/50mounted-tests
/usr/libexec/linux-boot-probes/mounted/40grub
/usr/libexec/linux-boot-probes/mounted/40grub2
/usr/libexec/linux-boot-probes/mounted/50lilo
/usr/libexec/linux-boot-probes/mounted/90fallback
/usr/libexec/newns
/usr/libexec/os-probes/50mounted-tests
/usr/libexec/os-probes/init/10filesystems
/usr/libexec/os-probes/mounted/05efi
/usr/libexec/os-probes/mounted/05efi.factor-out-logger-efi-fix
/usr/libexec/os-probes/mounted/10freedos
/usr/libexec/os-probes/mounted/10qnx
/usr/libexec/os-probes/mounted/20macosx
/usr/libexec/os-probes/mounted/20microsoft
/usr/libexec/os-probes/mounted/30utility
/usr/libexec/os-probes/mounted/40lsb
/usr/libexec/os-probes/mounted/70hurd
/usr/libexec/os-probes/mounted/80minix
/usr/libexec/os-probes/mounted/83haiku
/usr/libexec/os-probes/mounted/90linux-distro
/usr/libexec/os-probes/mounted/90solaris
/usr/libexec/os-probes/mounted/efi/10elilo
/usr/libexec/os-probes/mounted/efi/20microsoft
/usr/libexec/glib-pacrunner
/usr/libexec/ebtables
/usr/libexec/gnupg-pcsc-wrapper
/usr/libexec/gpg-check-pattern
/usr/libexec/gpg-preset-passphrase
/usr/libexec/gpg-protect-tool
/usr/libexec/gpg2keys_curl
/usr/libexec/gpg2keys_finger
/usr/libexec/gpg2keys_hkp
/usr/libexec/gpg2keys_ldap
/usr/libexec/plymouth/plymouth-generate-initrd
/usr/libexec/plymouth/plymouth-populate-initrd
/usr/libexec/plymouth/plymouth-update-initrd
/usr/libexec/nm-avahi-autoipd.action
/usr/libexec/nm-dhcp-helper
/usr/libexec/nm-dispatcher
/usr/libexec/nm-iface-helper
/usr/libexec/man-db/globbing
/usr/libexec/man-db/manconv
/usr/libexec/mlx4-setup.sh
/usr/libexec/rdma-fixup-mtrr.awk
/usr/libexec/rdma-init-kernel
/usr/libexec/rdma-set-sriov-vf
/usr/libexec/postfix/aliasesdb
/usr/libexec/postfix/anvil
/usr/libexec/postfix/bounce
/usr/libexec/postfix/chroot-update
/usr/libexec/postfix/cleanup
/usr/libexec/postfix/discard
/usr/libexec/postfix/dnsblog
/usr/libexec/postfix/error
/usr/libexec/postfix/flush
/usr/libexec/postfix/local
/usr/libexec/postfix/main.cf
/usr/libexec/postfix/master
/usr/libexec/postfix/master.cf
/usr/libexec/postfix/oqmgr
/usr/libexec/postfix/pickup
/usr/libexec/postfix/pipe
/usr/libexec/postfix/post-install
/usr/libexec/postfix/postfix-files
/usr/libexec/postfix/postfix-script
/usr/libexec/postfix/postfix-wrapper
/usr/libexec/postfix/postmulti-script
/usr/libexec/postfix/postscreen
/usr/libexec/postfix/proxymap
/usr/libexec/postfix/qmqpd
/usr/libexec/postfix/scache
/usr/libexec/postfix/showq
/usr/libexec/postfix/smtpd
/usr/libexec/postfix/spawn
/usr/libexec/postfix/tlsmgr
/usr/libexec/postfix/tlsproxy
/usr/libexec/postfix/trivial-rewrite
/usr/libexec/postfix/verify
/usr/libexec/postfix/virtual
/usr/libexec/postfix/lmtp
/usr/libexec/postfix/smtp
/usr/libexec/postfix/nqmgr
/usr/libexec/postfix/qmgr
/usr/libexec/sesh
/usr/libexec/sudo_noexec.so
/usr/libexec/sudoers.so
/usr/libexec/dbus-1/dbus-daemon-launch-helper
/usr/libexec/gstreamer-1.0/gst-plugin-scanner
/usr/libexec/gstreamer-1.0/gst-ptp-helper
/usr/libexec/dconf-service
/usr/libexec/geoclue
/usr/libexec/at-spi-bus-launcher
/usr/libexec/at-spi2-registryd
/usr/libexec/webkit2gtk-4.0/MiniBrowser
/usr/libexec/webkit2gtk-4.0/WebKitNetworkProcess
/usr/libexec/webkit2gtk-4.0/WebKitPluginProcess
/usr/libexec/webkit2gtk-4.0/WebKitWebProcess
/usr/libexec/webkit2gtk-4.0/jsc
/home/wang/.bash_logout
/home/wang/.bash_profile
/home/wang/.bashrc
/home/wang/.bash_history
/home/it101/.bash_logout
/home/it101/.bash_profile
/home/it101/.bashrc
/home/it1/.bash_logout
/home/it1/.bash_profile
/home/it1/.bashrc
/home/it2/.bash_logout
/home/it2/.bash_profile
/home/it2/.bashrc
/home/it3/.bash_logout
/home/it3/.bash_profile
/home/it3/.bashrc
/home/it4/.bash_logout
/home/it4/.bash_profile
/home/it4/.bashrc
/home/it5/.bash_logout
/home/it5/.bash_profile
/home/it5/.bashrc
/home/it6/.bash_logout
/home/it6/.bash_profile
/home/it6/.bashrc
/home/it7/.bash_logout
/home/it7/.bash_profile
/home/it7/.bashrc
/home/it8/.bash_logout
/home/it8/.bash_profile
/home/it8/.bashrc
/home/it9/.bash_logout
/home/it9/.bash_profile
/home/it9/.bashrc
/home/it10/.bash_logout
/home/it10/.bash_profile
/home/it10/.bashrc
/home/it11/.bash_logout
/home/it11/.bash_profile
/home/it11/.bashrc
/home/it12/.bash_logout
/home/it12/.bash_profile
/home/it12/.bashrc
/home/it13/.bash_logout
/home/it13/.bash_profile
/home/it13/.bashrc
/home/it14/.bash_logout
/home/it14/.bash_profile
/home/it14/.bashrc
/home/it15/.bash_logout
/home/it15/.bash_profile
/home/it15/.bashrc
/home/it16/.bash_logout
/home/it16/.bash_profile
/home/it16/.bashrc
/home/it17/.bash_logout
/home/it17/.bash_profile
/home/it17/.bashrc
/home/it18/.bash_logout
/home/it18/.bash_profile
/home/it18/.bashrc
/home/it19/.bash_logout
/home/it19/.bash_profile
/home/it19/.bashrc
/home/it20/.bash_logout
/home/it20/.bash_profile
/home/it20/.bashrc
/home/it21/.bash_logout
/home/it21/.bash_profile
/home/it21/.bashrc
/home/it22/.bash_logout
/home/it22/.bash_profile
/home/it22/.bashrc
/home/it23/.bash_logout
/home/it23/.bash_profile
/home/it23/.bashrc
/home/it24/.bash_logout
/home/it24/.bash_profile
/home/it24/.bashrc
/home/it25/.bash_logout
/home/it25/.bash_profile
/home/it25/.bashrc
/home/it26/.bash_logout
/home/it26/.bash_profile
/home/it26/.bashrc
/home/it27/.bash_logout
/home/it27/.bash_profile
/home/it27/.bashrc
/home/it28/.bash_logout
/home/it28/.bash_profile
/home/it28/.bashrc
/home/it29/.bash_logout
/home/it29/.bash_profile
/home/it29/.bashrc
/home/it30/.bash_logout
/home/it30/.bash_profile
/home/it30/.bashrc
/home/it31/.bash_logout
/home/it31/.bash_profile
/home/it31/.bashrc
/home/it32/.bash_logout
/home/it32/.bash_profile
/home/it32/.bashrc
/home/it33/.bash_logout
/home/it33/.bash_profile
/home/it33/.bashrc
/home/it34/.bash_logout
/home/it34/.bash_profile
/home/it34/.bashrc
/home/it35/.bash_logout
/home/it35/.bash_profile
/home/it35/.bashrc
/home/it36/.bash_logout
/home/it36/.bash_profile
/home/it36/.bashrc
/home/it37/.bash_logout
/home/it37/.bash_profile
/home/it37/.bashrc
/home/it38/.bash_logout
/home/it38/.bash_profile
/home/it38/.bashrc
/home/it39/.bash_logout
/home/it39/.bash_profile
/home/it39/.bashrc
/home/it40/.bash_logout
/home/it40/.bash_profile
/home/it40/.bashrc
/home/it41/.bash_logout
/home/it41/.bash_profile
/home/it41/.bashrc
/home/it42/.bash_logout
/home/it42/.bash_profile
/home/it42/.bashrc
/home/it43/.bash_logout
/home/it43/.bash_profile
/home/it43/.bashrc
/home/it44/.bash_logout
/home/it44/.bash_profile
/home/it44/.bashrc
/home/it45/.bash_logout
/home/it45/.bash_profile
/home/it45/.bashrc
/home/it46/.bash_logout
/home/it46/.bash_profile
/home/it46/.bashrc
/home/it47/.bash_logout
/home/it47/.bash_profile
/home/it47/.bashrc
/home/it48/.bash_logout
/home/it48/.bash_profile
/home/it48/.bashrc
/home/it49/.bash_logout
/home/it49/.bash_profile
/home/it49/.bashrc
/home/it50/.bash_logout
/home/it50/.bash_profile
/home/it50/.bashrc
/home/it51/.bash_logout
/home/it51/.bash_profile
/home/it51/.bashrc
/home/it52/.bash_logout
/home/it52/.bash_profile
/home/it52/.bashrc
/home/it53/.bash_logout
/home/it53/.bash_profile
/home/it53/.bashrc
/home/it54/.bash_logout
/home/it54/.bash_profile
/home/it54/.bashrc
/home/it55/.bash_logout
/home/it55/.bash_profile
/home/it55/.bashrc
/home/it56/.bash_logout
/home/it56/.bash_profile
/home/it56/.bashrc
/home/it57/.bash_logout
/home/it57/.bash_profile
/home/it57/.bashrc
/home/it58/.bash_logout
/home/it58/.bash_profile
/home/it58/.bashrc
/home/it59/.bash_logout
/home/it59/.bash_profile
/home/it59/.bashrc
/home/it60/.bash_logout
/home/it60/.bash_profile
/home/it60/.bashrc
/home/it61/.bash_logout
/home/it61/.bash_profile
/home/it61/.bashrc
/home/it62/.bash_logout
/home/it62/.bash_profile
/home/it62/.bashrc
/home/it63/.bash_logout
/home/it63/.bash_profile
/home/it63/.bashrc
/home/it64/.bash_logout
/home/it64/.bash_profile
/home/it64/.bashrc
/home/it65/.bash_logout
/home/it65/.bash_profile
/home/it65/.bashrc
/home/it66/.bash_logout
/home/it66/.bash_profile
/home/it66/.bashrc
/home/it67/.bash_logout
/home/it67/.bash_profile
/home/it67/.bashrc
/home/it68/.bash_logout
/home/it68/.bash_profile
/home/it68/.bashrc
/home/it69/.bash_logout
/home/it69/.bash_profile
/home/it69/.bashrc
/home/it70/.bash_logout
/home/it70/.bash_profile
/home/it70/.bashrc
/home/it71/.bash_logout
/home/it71/.bash_profile
/home/it71/.bashrc
/home/it72/.bash_logout
/home/it72/.bash_profile
/home/it72/.bashrc
/home/it73/.bash_logout
/home/it73/.bash_profile
/home/it73/.bashrc
/home/it74/.bash_logout
/home/it74/.bash_profile
/home/it74/.bashrc
/home/it75/.bash_logout
/home/it75/.bash_profile
/home/it75/.bashrc
/home/it76/.bash_logout
/home/it76/.bash_profile
/home/it76/.bashrc
/home/it77/.bash_logout
/home/it77/.bash_profile
/home/it77/.bashrc
/home/it78/.bash_logout
/home/it78/.bash_profile
/home/it78/.bashrc
/home/it79/.bash_logout
/home/it79/.bash_profile
/home/it79/.bashrc
/home/it80/.bash_logout
/home/it80/.bash_profile
/home/it80/.bashrc
/home/it81/.bash_logout
/home/it81/.bash_profile
/home/it81/.bashrc
/home/it82/.bash_logout
/home/it82/.bash_profile
/home/it82/.bashrc
/home/it83/.bash_logout
/home/it83/.bash_profile
/home/it83/.bashrc
/home/it84/.bash_logout
/home/it84/.bash_profile
/home/it84/.bashrc
/home/it85/.bash_logout
/home/it85/.bash_profile
/home/it85/.bashrc
/home/it86/.bash_logout
/home/it86/.bash_profile
/home/it86/.bashrc
/home/it87/.bash_logout
/home/it87/.bash_profile
/home/it87/.bashrc
/home/it88/.bash_logout
/home/it88/.bash_profile
/home/it88/.bashrc
/home/it89/.bash_logout
/home/it89/.bash_profile
/home/it89/.bashrc
/home/it90/.bash_logout
/home/it90/.bash_profile
/home/it90/.bashrc
/home/it91/.bash_logout
/home/it91/.bash_profile
/home/it91/.bashrc
/home/it92/.bash_logout
/home/it92/.bash_profile
/home/it92/.bashrc
/home/it93/.bash_logout
/home/it93/.bash_profile
/home/it93/.bashrc
/home/it94/.bash_logout
/home/it94/.bash_profile
/home/it94/.bashrc
/home/it95/.bash_logout
/home/it95/.bash_profile
/home/it95/.bashrc
/home/it96/.bash_logout
/home/it96/.bash_profile
/home/it96/.bashrc
/home/it97/.bash_logout
/home/it97/.bash_profile
/home/it97/.bashrc
/home/it98/.bash_logout
/home/it98/.bash_profile
/home/it98/.bashrc
/home/it99/.bash_logout
/home/it99/.bash_profile
/home/it99/.bashrc
/home/it100/.bash_logout
/home/it100/.bash_profile
/home/it100/.bashrc
/home/oldboy01/.bash_logout
/home/oldboy01/.bash_profile
/home/oldboy01/.bashrc
/home/oldboy02/.bash_logout
/home/oldboy02/.bash_profile
/home/oldboy02/.bashrc
/home/oldboy03/.bash_logout
/home/oldboy03/.bash_profile
/home/oldboy03/.bashrc
/home/oldboy04/.bash_logout
/home/oldboy04/.bash_profile
/home/oldboy04/.bashrc
/home/oldboy05/.bash_logout
/home/oldboy05/.bash_profile
/home/oldboy05/.bashrc
/home/oldboy06/.bash_logout
/home/oldboy06/.bash_profile
/home/oldboy06/.bashrc
/home/oldboy07/.bash_logout
/home/oldboy07/.bash_profile
/home/oldboy07/.bashrc
/home/oldboy08/.bash_logout
/home/oldboy08/.bash_profile
/home/oldboy08/.bashrc
/home/oldboy09/.bash_logout
/home/oldboy09/.bash_profile
/home/oldboy09/.bashrc
/home/oldboy10/.bash_logout
/home/oldboy10/.bash_profile
/home/oldboy10/.bashrc
/home/mailuser/.bash_logout
/home/mailuser/.bash_profile
/home/mailuser/.bashrc
/home/oldboy/.bash_logout
/home/oldboy/.bash_profile
/home/oldboy/.bashrc
/.autorelabel
[root@master ~]# find /etc -type f -mtime -7
/etc/resolv.conf
/etc/tuned/active_profile
/etc/motd
/etc/1.sh
/etc/inittab
/etc/group
/etc/gshadow
/etc/httpd/conf/httpd.conf
/etc/hosts
/etc/motdy
/etc/passwd
/etc/profile
/etc/shadow
/etc/ld.so.cache
/etc/xml/catalog
/etc/selinux/confiog
/etc/selinux/config
/etc/selinux/test.txt
/etc/dconf/db/site
/etc/dconf/db/local
/etc/dconf/db/distro
/etc/passwd-
/etc/shadow-
/etc/group-
/etc/gshadow-
/etc/hostname
[root@master ~]# find /boot -type f -mtime 7
三、正则符号
作用说明:查找文件内容信息
使用场景:三剑客命令常用/各种语言经常使用
(一)正则符号作用说明
方便匹配找出文件中的内容信息
(二)正则表达符号分类
1.基础正则表达式(basic regular expression)
^ $ . * [] [^]
2.扩展正则表达式(extended regular expression)
| + () {} ?
(三)正则符号注意事项
①. 按照每行信息进行过滤处理
②. 注意正则表达符号禁止中文
③. 附上颜色信息进行正则过滤
--color=auto/--color
(四)基础正则符号说明
01.尖角符号:^
表示以什么字符开头的一行信息
02.美元符号:$
表示以什么字符结尾的一行信息
03.空行符号:^$
表示过滤空行信息
04.点号符号:.
表示匹配任意一个且只有一个字符
grep -o "." test.txt
-o:表示显示grep命令执行过程
grep -o "." test.txt
h
i
t
8
9
:
x
:
1
0
9
0
:
1
0
9
0
:
:
/
h
o
m
e
/
i
t
8
9
:
/
b
i
n
/
b
a
s
h
i
t
9
0
:
x
:
1
0
9
1
:
1
0
9
1
:
:
/
h
o
m
e
/
i
t
9
0
:
/
b
i
n
/
b
a
s
h
i
t
9
1
:
x
:
1
0
9
2
:
1
0
9
2
:
:
/
h
o
m
e
/
i
t
9
1
:
/
b
i
n
/
b
a
s
h
i
t
9
2
:
x
:
1
0
9
3
:
1
0
9
3
:
:
/
h
o
m
e
/
i
t
9
2
:
/
b
i
n
/
b
a
s
h
i
t
9
3
:
x
:
1
0
9
4
:
1
0
9
4
:
:
/
h
o
m
e
/
i
t
9
3
:
/
b
i
n
/
b
a
s
h
i
t
9
4
:
x
:
1
0
9
5
:
1
0
9
5
:
:
/
h
o
m
e
/
i
t
9
4
:
/
b
i
n
/
b
a
s
h
i
t
9
5
:
x
:
1
0
9
6
:
1
0
9
6
:
:
/
h
o
m
e
/
i
t
9
5
:
/
b
i
n
/
b
a
s
h
i
t
9
6
:
x
:
1
0
9
7
:
1
0
9
7
:
:
/
h
o
m
e
/
i
t
9
6
:
/
b
i
n
/
b
a
s
h
i
t
9
7
:
x
:
1
0
9
8
:
1
0
9
8
:
:
/
h
o
m
e
/
i
t
9
7
:
/
b
i
n
/
b
a
s
h
i
t
9
8
:
x
:
1
0
9
9
:
1
0
9
9
:
:
/
h
o
m
e
/
i
t
9
8
:
/
b
i
n
/
b
a
s
h
i
t
9
9
:
x
:
1
1
0
0
:
1
1
0
0
:
:
/
h
o
m
e
/
i
t
9
9
:
/
b
i
n
/
b
a
s
h
i
t
1
0
0
:
x
:
1
1
0
1
:
1
1
0
1
:
:
/
h
o
m
e
/
i
t
1
0
0
:
/
b
i
n
/
b
a
s
h
a
p
a
c
h
e
:
x
:
4
8
:
4
8
:
A
p
a
c
h
e
:
/
u
s
r
/
s
h
a
r
e
/
h
t
t
p
d
:
/
s
b
i
n
/
n
o
l
o
g
i
n
o
l
d
b
o
y
0
1
:
x
:
1
1
0
2
:
1
1
0
3
:
:
/
h
o
m
e
/
o
l
d
b
o
y
0
1
:
/
b
i
n
/
b
a
s
h
o
l
d
b
o
y
0
2
:
x
:
1
1
0
3
:
1
1
0
4
:
:
/
h
o
m
e
/
o
l
d
b
o
y
0
2
:
/
b
i
n
/
b
a
s
h
o
l
d
b
o
y
0
3
:
x
:
1
1
0
4
:
1
1
0
5
:
:
/
h
o
m
e
/
o
l
d
b
o
y
0
3
:
/
b
i
n
/
b
a
s
h
o
l
d
b
o
y
0
4
:
x
:
1
1
0
5
:
1
1
0
6
:
:
/
h
o
m
e
/
o
l
d
b
o
y
0
4
:
/
b
i
n
/
b
a
s
h
o
l
d
b
o
y
0
5
:
x
:
1
1
0
6
:
1
1
0
7
:
:
/
h
o
m
e
/
o
l
d
b
o
y
0
5
:
/
b
i
n
/
b
a
s
h
o
l
d
b
o
y
0
6
:
x
:
1
1
0
7
:
1
1
0
8
:
:
/
h
o
m
e
/
o
l
d
b
o
y
0
6
:
/
b
i
n
/
b
a
s
h
o
l
d
b
o
y
0
7
:
x
:
1
1
0
8
:
1
1
0
9
:
:
/
h
o
m
e
/
o
l
d
b
o
y
0
7
:
/
b
i
n
/
b
a
s
h
o
l
d
b
o
y
0
8
:
x
:
1
1
0
9
:
1
1
1
0
:
:
/
h
o
m
e
/
o
l
d
b
o
y
0
8
:
/
b
i
n
/
b
a
s
h
o
l
d
b
o
y
0
9
:
x
:
1
1
1
0
:
1
1
1
1
:
:
/
h
o
m
e
/
o
l
d
b
o
y
0
9
:
/
b
i
n
/
b
a
s
h
o
l
d
b
o
y
1
0
:
x
:
1
1
1
1
:
1
1
1
2
:
:
/
h
o
m
e
/
o
l
d
b
o
y
1
0
:
/
b
i
n
/
b
a
s
h
m
a
i
l
u
s
e
r
:
x
:
1
1
1
2
:
1
1
1
3
:
:
/
h
o
m
e
/
m
a
i
l
u
s
e
r
:
/
b
i
n
/
b
a
s
h
o
l
d
b
o
y
:
x
:
1
1
1
3
:
1
1
1
4
:
:
/
h
o
m
e
/
o
l
d
b
o
y
:
/
b
i
n
/
b
a
s
h
05.星号符号:*
表示前一个字符出现0次或者多次
06.点星符号:.*
表示匹配文件中所有信息(包含空行)
^.*xxx
表示以任意字符开头xxx结尾(贪婪匹配)
^xxx.*xxx$
表示以xxx开头,xxx结尾的所有行
07.转移符号:\
表示还原字符的本来意思
'\.$'
表示查询出以点结尾的行信息
tr 源信息 替换后信息 <文件信息
表示对数据信息进行替换处理,采用一对一替换(sed命令的阉割版)
转移符号的常见用法汇总
\n
表示匹配一个换行符号
\r
表示匹配一个换行符号
\t
表示匹配一个制表符号
08.括号符号:[ ]
表示包含括号中信息的
[abc]
表示匹配包含a或b或c信息的字符
^[abc]
表示匹配包含a或b或c信息的字符开头的信息
[a-zA-Z0-9]
找出所有以小写字母大写字母和数字信息的字符
[a-Z]
找出所有以小写字母或大写字母组成字符(只能grep/egrep使用)
^[a-z].*[.!]$
表示以小写字母开头并且以点或叹号结尾的信息过滤出来
(五)扩展正则符号说明
01.加号符号:+
表示前一个字符连续出现了1次或多次以上
egrep "0+" file
表示取出数字0字符,以及连续的多个数字0字符
egrep "[a-z]+" file
表示取出文件中的所有连续的小写字母(其实是取出单词信息)
补充总结说明
一般加号符号经常是与中括号使用,可以匹配出多个不同的连续字符
02.竖线符号:|
表示匹配多个满足条件的信息(或者)
03.括号符号:()
表示匹配一个整体信息
egrep “oldb(o|e)y" file
表示过滤指定整体信息
04.括号符号:{}
表示定义前面字符出现次数
x{n,m}
表示前一个字符至少连续出现n次,最多出现m次
x{n}
表示前一个字符正好连续出现了n次
x{n,}
表示前一个字符至少连续出现n次,最多出现多少次不限
x{,m}
表示前一个字符至少连续出现0次,最多出现m次
05.问号符号:?
表示定义前面字符出现0次或1次
PS:扩展正则符号
默认grep sed 命令不能直接识别
grep 提升自己 egrep/grep -E
sed 提升自己 sed -r
(六)正则符号使用问题
①. 问题:尖角符号和星号符号区别?
^d和d*
^d: 在正则表达式中,^ 表示行首。因此,^d 会匹配以字符 "d" 开头的字符串。
d: 星号 * 是一个量词,表示前面紧邻的字符可以重复零次或多次。所以 d 会匹配任何包含零个或多个连续 "d" 字符的字符串。
②. 问题:星号符号匹配不存在信息?
grep ''
在某些上下文中,使用空字符串作为 grep 的搜索模式时,并不会特意去匹配不存在的信息。例如,grep '' 将查找包含空行或者空白字符(如制表符、换行符)的行。而直接用星号 * 不太常见,因为通常它需要与一个字符结合使用才有意义,比如 grep '.*' 可以匹配任意内容的行。
如果你是在问能否通过星号来匹配文件中不含有特定字符的情况,那么答案是不能直接这样做。但可以通过否定性匹配,例如在 grep 中使用 -v 参数和具体模式实现反向匹配。
③. 问题:过滤时是否使用引号区别?
egrep [ab]{1,} oldboy.txt
在 shell 命令行中使用 egrep 或 grep -E(扩展正则表达式模式)时,引号 主要用于保护特殊字符,防止它们被 shell 解释
(七)正则符号特性说明
①. 正则表达符号具有贪婪特性
②扩展正则转换 基础正则方法.
grep 'go\+d'
五、grep(过滤筛选信息)
grep参数介绍
-A after 在什么后面
-B before 在什么前面
-C centre 在什么中间
-c 统计信息出现的次数
grep命令如何进行过滤
1.筛选出有test的信息
grep "test" test.txt --从test.txt文件中筛选出有test的信息
[root@master ~]# grep "test" test.txt
atest
test
gnsdgkhsgtest
test
testdklfgjslajfhhtest
testdkfkashf
test
test
sdjfsksdjfkashjhtest
2.筛选出有test的信息,但要有test信息的上一行信息也显示
grep -B 1 "test" test.txt
3.筛选出有test的信息,但要有test信息的下一行信息也显示
grep -A 1 "test" test.txt
4.筛选出有test的信息,但要有test信息的上一行和下一行信息也显示
grep -C 1 "test" test.txt
5.统计test信息在文件中出现了几次
grep -c 1 "test" test.txt
[root@master ~]# grep -B1 "test" test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
[root@master ~]# grep -B1 "test" test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
[root@master ~]# grep -A1 "test" test.txt
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
[root@master ~]# grep -C1 "test" test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
[root@master ~]# grep -c1 "test" test.txt
3
六、sed(修改替换文件内容 擅长对文件中的行进行操作)
1)概念介绍
官方概念:字符流过滤编辑和文本字符流转换工具
功能应用说明:
01.处理文本信息
文本文件信息(小文件)
日志文件信息(grep awk分析)
配置文件信息(sed)
02.处理文件方式
增加信息
删除信息
修改信息
查找信息
2)sed命令的执行流程
3)sed命令实际应用
命令语法格式:
标准格式:sed [选项] [sed指令] [文件信息]
举例说明:sed -i.bak 's#test#test01#g' test.txt
sed命令参数信息:
-n 取消默认输出
-r 识别扩展正则
-i 真实编辑文件(将内存中的信息覆盖到磁盘中)
-e 识别sed命令多个操作指令
sed命令指令信息:
p print 输出信息
i insert 插入信息,在指定信息前面插入新的信息
a append 附加信息,在指定信息后面附加新的信息
d delete 删除指定信息
s substitute 替换信息 s###g(全局替换)
c 替换修改指定的一整行信息
指令修饰:g
PS:相同指令信息只能使用一次,想使用多次需要加上分号
sed命令学习:
sed功能:增加 删除 修改 查看
sed 语法
sed 参数 条件 文本
sed -n /abc/p test
工作需求:
修改网卡信息:
sed -i s/192.168.1.100/192.168.1.101/g /etc/sysconfig/network-scripts/ifcfg-ens33
systemtcl restart network
sed功能:增加 删除 修改 查看
01 查询:
显示abc的行:sed -n /abc/p p.txt
显示1-3行信息:sed -n '1,3p' p.txt
[root@master p]# sed -n /abc/p p.txt
abc
abcdkfhaskfhsabc
sdkhgksdhgabc
shfkashabc
abc
abc
abc
rsdfhshfaabc
[root@master p]# sed -n '1,3p' p.txt
abc
abcdkfhaskfhsabc
sdkfhkshf'
02 添加信息
i:插入信息 指定在前面插入
a:附件信息 ,指定在后面加入信息 如果行尾就用$a
需求1:
在文件第一行添加一个old信息
sed '2iold' test
[root@master ~]# sed '2iold' test.txt
Line 1
old
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
需求2:
在文件后面插入old
sed '6aold' test
[root@master ~]# sed '6aold' test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
old
Final line
笔试题:
01:在第三行后面添加dog
sed '3adog' test
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# sed '3adog' test.txt
Line 1
Line with test word
Line after the first test
dog
Some other lines...
Another line with test
More content here...
Final line
02: 在第二行前面添加cat
sed '2icat' test
03:dog行的前面添加123 后面添加100
sed -e '/dog/i123' -e '/dog/a100' test
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# sed '2icat' test.txt
Line 1
cat
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# sed -e '/dog/i123' -e '/dog/a100' test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
03:删除
需求1: 第3行文件干掉:sed '3d' test
需求2: 删除1-3行:sed '1,3d' test
需求3:删除包含123 行 : sed '/123/d' test
删除第一行和第7行
sed '1d;7d' test
删除空行:
sed '/^$/d' test
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# sed '3d' test.txt
Line 1
Line with test word
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# sed '1,3d' test.txt
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# sed '/123/d' test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# sed '1d;3d' test.txt
Line with test word
Some other lines...
Another line with test
More content here...
Final line
[root@master ~]# sed '1d;7d' test.txt
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
[root@master ~]# vi test.txt
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '/^$/d' test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
04 :修改
需求1:
替换信息
sed s/123/100/g test
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed s/d/100/g test.txt
Line 1
Line with test wor100
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgas100g100f
100fg100fg
100fgas100g
fga
a
g
asg
gaga100ga100g
agas
### 工作笔试题:
取出ifconfIg ens33命令中本机的IPv4地址
ip a| grep ens37| grep inet|awk '{print $2}'
ip a| grep ens37| grep inet|awk '{print $2}'|awk -F "/" '{print $1}'
[root@master ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:4c:25:86 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.164/24 brd 10.0.0.255 scope global dynamic eno16777736
valid_lft 1121sec preferred_lft 1121sec
inet6 fe80::20c:29ff:fe4c:2586/64 scope link
valid_lft forever preferred_lft forever
[root@master ~]# ip a |grep eno16777736 |grep inet|awk '{print $2}'
10.0.0.164/24
[root@master ~]# ip a |grep eno16777736 |grep inet |awk '{print $2}' | awk -F "/" '{print $1}'
10.0.0.164
把/etc/passwd 复制到/root/passwd,用sed打印所有行
cp /etc/passwd /root/passwd
sed 'p' passwd
[root@master ~]# cp /etc/passwd /root/passwd
[root@master ~]# cd /root/passwd/
[root@master passwd]# ls
passwd
[root@master passwd]# ^C
[root@master passwd]# sed 'p' passwd
root0:0:root:/root:/bin/bash
root0:0:root:/root:/bin/bash
bin1:1:bin:/bin:/sbin/nologin
bin1:1:bin:/bin:/sbin/nologin
daemon2:2:daemon:/sbin:/sbin/nologin
daemon2:2:daemon:/sbin:/sbin/nologin
adm3:4:adm:/var/adm:/sbin/nologin
adm3:4:adm:/var/adm:/sbin/nologin
lp4:7:lp:/var/spool/lpd:/sbin/nologin
lp4:7:lp:/var/spool/lpd:/sbin/nologin
sync5:0:sync:/sbin:/bin/sync
sync5:0:sync:/sbin:/bin/sync
shutdown6:0:shutdown:/sbin:/sbin/shutdown
shutdown6:0:shutdown:/sbin:/sbin/shutdown
halt7:0:halt:/sbin:/sbin/halt
halt7:0:halt:/sbin:/sbin/halt
mail8:12:mail:/var/spool/mail:/sbin/nologin
mail8:12:mail:/var/spool/mail:/sbin/nologin
operator11:0:operator:/root:/sbin/nologin
operator11:0:operator:/root:/sbin/nologin
games12games:/usr/games:/sbin/nologin
games12games:/usr/games:/sbin/nologin
ftp14:50:FTP User:/var/ftp:/sbin/nologin
ftp14:50:FTP User:/var/ftp:/sbin/nologin
nobody99:99:Nobody:/:/sbin/nologin
nobody99:99:Nobody:/:/sbin/nologin
avahi-autoipd170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
avahi-autoipd170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
dbus81:81:System message bus:/:/sbin/nologin
dbus81:81:System message bus:/:/sbin/nologin
polkitd999:998:User for polkitd:/:/sbin/nologin
polkitd999:998:User for polkitd:/:/sbin/nologin
tss59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
tss59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
postfix89:89::/var/spool/postfix:/sbin/nologin
postfix89:89::/var/spool/postfix:/sbin/nologin
sshd74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
sshd74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
wang1000:1000:wang:/home/wang:/bin/bash
wang1000:1000:wang:/home/wang:/bin/bash
systemd-network192:192:systemd Network Management:/:/sbin/nologin
systemd-network192:192:systemd Network Management:/:/sbin/nologin
it1011001:1001::/home/it101:/bin/bash
it1011001:1001::/home/it101:/bin/bash
it11002:1002::/home/it1:/bin/bash
it11002:1002::/home/it1:/bin/bash
it21003:1003::/home/it2:/bin/bash
it21003:1003::/home/it2:/bin/bash
it31004:1004::/home/it3:/bin/bash
it31004:1004::/home/it3:/bin/bash
it41005:1005::/home/it4:/bin/bash
it41005:1005::/home/it4:/bin/bash
it51006:1006::/home/it5:/bin/bash
it51006:1006::/home/it5:/bin/bash
it61007:1007::/home/it6:/bin/bash
it61007:1007::/home/it6:/bin/bash
it71008:1008::/home/it7:/bin/bash
it71008:1008::/home/it7:/bin/bash
it81009:1009::/home/it8:/bin/bash
it81009:1009::/home/it8:/bin/bash
it91010:1010::/home/it9:/bin/bash
it91010:1010::/home/it9:/bin/bash
it101011:1011::/home/it10:/bin/bash
it101011:1011::/home/it10:/bin/bash
it111012:1012::/home/it11:/bin/bash
it111012:1012::/home/it11:/bin/bash
it121013:1013::/home/it12:/bin/bash
it121013:1013::/home/it12:/bin/bash
it131014:1014::/home/it13:/bin/bash
it131014:1014::/home/it13:/bin/bash
it141015:1015::/home/it14:/bin/bash
it141015:1015::/home/it14:/bin/bash
it151016:1016::/home/it15:/bin/bash
it151016:1016::/home/it15:/bin/bash
it161017:1017::/home/it16:/bin/bash
it161017:1017::/home/it16:/bin/bash
it171018:1018::/home/it17:/bin/bash
it171018:1018::/home/it17:/bin/bash
it181019:1019::/home/it18:/bin/bash
it181019:1019::/home/it18:/bin/bash
it191020:1020::/home/it19:/bin/bash
it191020:1020::/home/it19:/bin/bash
it201021:1021::/home/it20:/bin/bash
it201021:1021::/home/it20:/bin/bash
it211022:1022::/home/it21:/bin/bash
it211022:1022::/home/it21:/bin/bash
it221023:1023::/home/it22:/bin/bash
it221023:1023::/home/it22:/bin/bash
it231024:1024::/home/it23:/bin/bash
it231024:1024::/home/it23:/bin/bash
it241025:1025::/home/it24:/bin/bash
it241025:1025::/home/it24:/bin/bash
it251026:1026::/home/it25:/bin/bash
it251026:1026::/home/it25:/bin/bash
it261027:1027::/home/it26:/bin/bash
it261027:1027::/home/it26:/bin/bash
it271028:1028::/home/it27:/bin/bash
it271028:1028::/home/it27:/bin/bash
it281029:1029::/home/it28:/bin/bash
it281029:1029::/home/it28:/bin/bash
it291030:1030::/home/it29:/bin/bash
it291030:1030::/home/it29:/bin/bash
it301031:1031::/home/it30:/bin/bash
it301031:1031::/home/it30:/bin/bash
it311032:1032::/home/it31:/bin/bash
it311032:1032::/home/it31:/bin/bash
it321033:1033::/home/it32:/bin/bash
it321033:1033::/home/it32:/bin/bash
it331034:1034::/home/it33:/bin/bash
it331034:1034::/home/it33:/bin/bash
it341035:1035::/home/it34:/bin/bash
it341035:1035::/home/it34:/bin/bash
it351036:1036::/home/it35:/bin/bash
it351036:1036::/home/it35:/bin/bash
it361037:1037::/home/it36:/bin/bash
it361037:1037::/home/it36:/bin/bash
it371038:1038::/home/it37:/bin/bash
it371038:1038::/home/it37:/bin/bash
it381039:1039::/home/it38:/bin/bash
it381039:1039::/home/it38:/bin/bash
it391040:1040::/home/it39:/bin/bash
it391040:1040::/home/it39:/bin/bash
it401041:1041::/home/it40:/bin/bash
it401041:1041::/home/it40:/bin/bash
it411042:1042::/home/it41:/bin/bash
it411042:1042::/home/it41:/bin/bash
it421043:1043::/home/it42:/bin/bash
it421043:1043::/home/it42:/bin/bash
it431044:1044::/home/it43:/bin/bash
it431044:1044::/home/it43:/bin/bash
it441045:1045::/home/it44:/bin/bash
it441045:1045::/home/it44:/bin/bash
it451046:1046::/home/it45:/bin/bash
it451046:1046::/home/it45:/bin/bash
it461047:1047::/home/it46:/bin/bash
it461047:1047::/home/it46:/bin/bash
it471048:1048::/home/it47:/bin/bash
it471048:1048::/home/it47:/bin/bash
it481049:1049::/home/it48:/bin/bash
it481049:1049::/home/it48:/bin/bash
it491050:1050::/home/it49:/bin/bash
it491050:1050::/home/it49:/bin/bash
it501051:1051::/home/it50:/bin/bash
it501051:1051::/home/it50:/bin/bash
it511052:1052::/home/it51:/bin/bash
it511052:1052::/home/it51:/bin/bash
it521053:1053::/home/it52:/bin/bash
it521053:1053::/home/it52:/bin/bash
it531054:1054::/home/it53:/bin/bash
it531054:1054::/home/it53:/bin/bash
it541055:1055::/home/it54:/bin/bash
it541055:1055::/home/it54:/bin/bash
it551056:1056::/home/it55:/bin/bash
it551056:1056::/home/it55:/bin/bash
it561057:1057::/home/it56:/bin/bash
it561057:1057::/home/it56:/bin/bash
it571058:1058::/home/it57:/bin/bash
it571058:1058::/home/it57:/bin/bash
it581059:1059::/home/it58:/bin/bash
it581059:1059::/home/it58:/bin/bash
it591060:1060::/home/it59:/bin/bash
it591060:1060::/home/it59:/bin/bash
it601061:1061::/home/it60:/bin/bash
it601061:1061::/home/it60:/bin/bash
it611062:1062::/home/it61:/bin/bash
it611062:1062::/home/it61:/bin/bash
it621063:1063::/home/it62:/bin/bash
it621063:1063::/home/it62:/bin/bash
it631064:1064::/home/it63:/bin/bash
it631064:1064::/home/it63:/bin/bash
it641065:1065::/home/it64:/bin/bash
it641065:1065::/home/it64:/bin/bash
it651066:1066::/home/it65:/bin/bash
it651066:1066::/home/it65:/bin/bash
it661067:1067::/home/it66:/bin/bash
it661067:1067::/home/it66:/bin/bash
it671068:1068::/home/it67:/bin/bash
it671068:1068::/home/it67:/bin/bash
it681069:1069::/home/it68:/bin/bash
it681069:1069::/home/it68:/bin/bash
it691070:1070::/home/it69:/bin/bash
it691070:1070::/home/it69:/bin/bash
it701071:1071::/home/it70:/bin/bash
it701071:1071::/home/it70:/bin/bash
it711072:1072::/home/it71:/bin/bash
it711072:1072::/home/it71:/bin/bash
it721073:1073::/home/it72:/bin/bash
it721073:1073::/home/it72:/bin/bash
it731074:1074::/home/it73:/bin/bash
it731074:1074::/home/it73:/bin/bash
it741075:1075::/home/it74:/bin/bash
it741075:1075::/home/it74:/bin/bash
it751076:1076::/home/it75:/bin/bash
it751076:1076::/home/it75:/bin/bash
it761077:1077::/home/it76:/bin/bash
it761077:1077::/home/it76:/bin/bash
it771078:1078::/home/it77:/bin/bash
it771078:1078::/home/it77:/bin/bash
it781079:1079::/home/it78:/bin/bash
it781079:1079::/home/it78:/bin/bash
it791080:1080::/home/it79:/bin/bash
it791080:1080::/home/it79:/bin/bash
it801081:1081::/home/it80:/bin/bash
it801081:1081::/home/it80:/bin/bash
it811082:1082::/home/it81:/bin/bash
it811082:1082::/home/it81:/bin/bash
it821083:1083::/home/it82:/bin/bash
it821083:1083::/home/it82:/bin/bash
it831084:1084::/home/it83:/bin/bash
it831084:1084::/home/it83:/bin/bash
it841085:1085::/home/it84:/bin/bash
it841085:1085::/home/it84:/bin/bash
it851086:1086::/home/it85:/bin/bash
it851086:1086::/home/it85:/bin/bash
it861087:1087::/home/it86:/bin/bash
it861087:1087::/home/it86:/bin/bash
it871088:1088::/home/it87:/bin/bash
it871088:1088::/home/it87:/bin/bash
it881089:1089::/home/it88:/bin/bash
it881089:1089::/home/it88:/bin/bash
it891090:1090::/home/it89:/bin/bash
it891090:1090::/home/it89:/bin/bash
it901091:1091::/home/it90:/bin/bash
it901091:1091::/home/it90:/bin/bash
it911092:1092::/home/it91:/bin/bash
it911092:1092::/home/it91:/bin/bash
it921093:1093::/home/it92:/bin/bash
it921093:1093::/home/it92:/bin/bash
it931094:1094::/home/it93:/bin/bash
it931094:1094::/home/it93:/bin/bash
it941095:1095::/home/it94:/bin/bash
it941095:1095::/home/it94:/bin/bash
it951096:1096::/home/it95:/bin/bash
it951096:1096::/home/it95:/bin/bash
it961097:1097::/home/it96:/bin/bash
it961097:1097::/home/it96:/bin/bash
it971098:1098::/home/it97:/bin/bash
it971098:1098::/home/it97:/bin/bash
it981099:1099::/home/it98:/bin/bash
it981099:1099::/home/it98:/bin/bash
it991100:1100::/home/it99:/bin/bash
it991100:1100::/home/it99:/bin/bash
it1001101:1101::/home/it100:/bin/bash
it1001101:1101::/home/it100:/bin/bash
apache48:48:Apache:/usr/share/httpd:/sbin/nologin
apache48:48:Apache:/usr/share/httpd:/sbin/nologin
oldboy011102:1103::/home/oldboy01:/bin/bash
oldboy011102:1103::/home/oldboy01:/bin/bash
oldboy021103:1104::/home/oldboy02:/bin/bash
oldboy021103:1104::/home/oldboy02:/bin/bash
oldboy031104:1105::/home/oldboy03:/bin/bash
oldboy031104:1105::/home/oldboy03:/bin/bash
oldboy041105:1106::/home/oldboy04:/bin/bash
oldboy041105:1106::/home/oldboy04:/bin/bash
oldboy051106:1107::/home/oldboy05:/bin/bash
oldboy051106:1107::/home/oldboy05:/bin/bash
oldboy061107:1108::/home/oldboy06:/bin/bash
oldboy061107:1108::/home/oldboy06:/bin/bash
oldboy071108:1109::/home/oldboy07:/bin/bash
oldboy071108:1109::/home/oldboy07:/bin/bash
oldboy081109:1110::/home/oldboy08:/bin/bash
oldboy081109:1110::/home/oldboy08:/bin/bash
oldboy091110:1111::/home/oldboy09:/bin/bash
oldboy091110:1111::/home/oldboy09:/bin/bash
oldboy101111:1112::/home/oldboy10:/bin/bash
oldboy101111:1112::/home/oldboy10:/bin/bash
mailuser1112:1113::/home/mailuser:/bin/bash
mailuser1112:1113::/home/mailuser:/bin/bash
oldboy1113:1114::/home/oldboy:/bin/bash
oldboy1113:1114::/home/oldboy:/bin/bash
dhcpd177:177:DHCP server:/:/sbin/nologin
dhcpd177:177:DHCP server:/:/sbin/nologin
geoclue998:996:User for geoclue:/var/lib/geoclue:/sbin/nologin
geoclue998:996:User for geoclue:/var/lib/geoclue:/sbin/nologin
打印passwd 的3到10行
sed -n 3,10p passwd
打印passwd中包含 ‘root’ 的行
sed -n '/root/p' passwd
[root@master passwd]# sed -n 3,10p passwd
daemon2:2:daemon:/sbin:/sbin/nologin
adm3:4:adm:/var/adm:/sbin/nologin
lp4:7:lp:/var/spool/lpd:/sbin/nologin
sync5:0:sync:/sbin:/bin/sync
shutdown6:0:shutdown:/sbin:/sbin/shutdown
halt7:0:halt:/sbin:/sbin/halt
mail8:12:mail:/var/spool/mail:/sbin/nologin
operator11:0:operator:/root:/sbin/nologin
[root@master passwd]# sed -n '/root/p' passwd
root0:0:root:/root:/bin/bash
operator11:0:operator:/root:/sbin/nologin
删除passwd 的15行以及以后所有行
sed '15,$d' passwd
[root@master passwd]# sed -n 3,10p passwd
daemon2:2:daemon:/sbin:/sbin/nologin
adm3:4:adm:/var/adm:/sbin/nologin
lp4:7:lp:/var/spool/lpd:/sbin/nologin
sync5:0:sync:/sbin:/bin/sync
shutdown6:0:shutdown:/sbin:/sbin/shutdown
halt7:0:halt:/sbin:/sbin/halt
mail8:12:mail:/var/spool/mail:/sbin/nologin
operator11:0:operator:/root:/sbin/nologin
[root@master passwd]# sed -n '/root/p' passwd
root0:0:root:/root:/bin/bash
operator11:0:operator:/root:/sbin/nologin
[root@master passwd]# sed '15,$d' passwd
root0:0:root:/root:/bin/bash
bin1:1:bin:/bin:/sbin/nologin
daemon2:2:daemon:/sbin:/sbin/nologin
adm3:4:adm:/var/adm:/sbin/nologin
lp4:7:lp:/var/spool/lpd:/sbin/nologin
sync5:0:sync:/sbin:/bin/sync
shutdown6:0:shutdown:/sbin:/sbin/shutdown
halt7:0:halt:/sbin:/sbin/halt
mail8:12:mail:/var/spool/mail:/sbin/nologin
operator11:0:operator:/root:/sbin/nologin
games12games:/usr/games:/sbin/nologin
ftp14:50:FTP User:/var/ftp:/sbin/nologin
nobody99:99:Nobody:/:/sbin/nologin
avahi-autoipd170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
删除passwd中包含 ‘bash’ 的行
sed '/bash/d' passwd
[root@master passwd]# sed '/bash/d' passwd
bin1:1:bin:/bin:/sbin/nologin
daemon2:2:daemon:/sbin:/sbin/nologin
adm3:4:adm:/var/adm:/sbin/nologin
lp4:7:lp:/var/spool/lpd:/sbin/nologin
sync5:0:sync:/sbin:/bin/sync
shutdown6:0:shutdown:/sbin:/sbin/shutdown
halt7:0:halt:/sbin:/sbin/halt
mail8:12:mail:/var/spool/mail:/sbin/nologin
operator11:0:operator:/root:/sbin/nologin
games12games:/usr/games:/sbin/nologin
ftp14:50:FTP User:/var/ftp:/sbin/nologin
nobody99:99:Nobody:/:/sbin/nologin
avahi-autoipd170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
dbus81:81:System message bus:/:/sbin/nologin
polkitd999:998:User for polkitd:/:/sbin/nologin
tss59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
postfix89:89::/var/spool/postfix:/sbin/nologin
sshd74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
systemd-network192:192:systemd Network Management:/:/sbin/nologin
apache48:48:Apache:/usr/share/httpd:/sbin/nologin
dhcpd177:177:DHCP server:/:/sbin/nologin
geoclue998:996:User for geoclue:/var/lib/geoclue:/sbin/nologin
替换passwd 中 ‘root’ 为 ‘ha’
cat passwd | grep root|sed s/root/ha/g
[root@master passwd]# cat passwd | grep root |sed s/root/ha/g
ha0:0:ha:/ha:/bin/bash
operator11:0:operator:/ha:/sbin/nologin
替换passwd 中 ‘/sbin/nologin’ 为 ‘/sbin/nologin’
sed -i s#/sbin/nologin#/bin/login#g passwd
[root@master passwd]# sed -i s#/sbin/nologin#/bin/login#g passwd
[root@master passwd]# cat passwd
root0:0:root:/root:/bin/bash
bin1:1:bin:/bin:/bin/login
daemon2:2:daemon:/sbin:/bin/login
adm3:4:adm:/var/adm:/bin/login
lp4:7:lp:/var/spool/lpd:/bin/login
sync5:0:sync:/sbin:/bin/sync
shutdown6:0:shutdown:/sbin:/sbin/shutdown
halt7:0:halt:/sbin:/sbin/halt
mail8:12:mail:/var/spool/mail:/bin/login
operator11:0:operator:/root:/bin/login
games12games:/usr/games:/bin/login
ftp14:50:FTP User:/var/ftp:/bin/login
nobody99:99:Nobody:/:/bin/login
avahi-autoipd170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/bin/login
dbus81:81:System message bus:/:/bin/login
polkitd999:998:User for polkitd:/:/bin/login
tss59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/bin/login
postfix89:89::/var/spool/postfix:/bin/login
sshd74:74:Privilege-separated SSH:/var/empty/sshd:/bin/login
wang1000:1000:wang:/home/wang:/bin/bash
systemd-network192:192:systemd Network Management:/:/bin/login
it1011001:1001::/home/it101:/bin/bash
it11002:1002::/home/it1:/bin/bash
it21003:1003::/home/it2:/bin/bash
it31004:1004::/home/it3:/bin/bash
it41005:1005::/home/it4:/bin/bash
it51006:1006::/home/it5:/bin/bash
it61007:1007::/home/it6:/bin/bash
it71008:1008::/home/it7:/bin/bash
it81009:1009::/home/it8:/bin/bash
it91010:1010::/home/it9:/bin/bash
it101011:1011::/home/it10:/bin/bash
it111012:1012::/home/it11:/bin/bash
it121013:1013::/home/it12:/bin/bash
it131014:1014::/home/it13:/bin/bash
it141015:1015::/home/it14:/bin/bash
it151016:1016::/home/it15:/bin/bash
it161017:1017::/home/it16:/bin/bash
it171018:1018::/home/it17:/bin/bash
it181019:1019::/home/it18:/bin/bash
it191020:1020::/home/it19:/bin/bash
it201021:1021::/home/it20:/bin/bash
it211022:1022::/home/it21:/bin/bash
it221023:1023::/home/it22:/bin/bash
it231024:1024::/home/it23:/bin/bash
it241025:1025::/home/it24:/bin/bash
it251026:1026::/home/it25:/bin/bash
it261027:1027::/home/it26:/bin/bash
it271028:1028::/home/it27:/bin/bash
it281029:1029::/home/it28:/bin/bash
it291030:1030::/home/it29:/bin/bash
it301031:1031::/home/it30:/bin/bash
it311032:1032::/home/it31:/bin/bash
it321033:1033::/home/it32:/bin/bash
it331034:1034::/home/it33:/bin/bash
it341035:1035::/home/it34:/bin/bash
it351036:1036::/home/it35:/bin/bash
it361037:1037::/home/it36:/bin/bash
it371038:1038::/home/it37:/bin/bash
it381039:1039::/home/it38:/bin/bash
it391040:1040::/home/it39:/bin/bash
it401041:1041::/home/it40:/bin/bash
it411042:1042::/home/it41:/bin/bash
it421043:1043::/home/it42:/bin/bash
it431044:1044::/home/it43:/bin/bash
it441045:1045::/home/it44:/bin/bash
it451046:1046::/home/it45:/bin/bash
it461047:1047::/home/it46:/bin/bash
it471048:1048::/home/it47:/bin/bash
it481049:1049::/home/it48:/bin/bash
it491050:1050::/home/it49:/bin/bash
it501051:1051::/home/it50:/bin/bash
it511052:1052::/home/it51:/bin/bash
it521053:1053::/home/it52:/bin/bash
it531054:1054::/home/it53:/bin/bash
it541055:1055::/home/it54:/bin/bash
it551056:1056::/home/it55:/bin/bash
it561057:1057::/home/it56:/bin/bash
it571058:1058::/home/it57:/bin/bash
it581059:1059::/home/it58:/bin/bash
it591060:1060::/home/it59:/bin/bash
it601061:1061::/home/it60:/bin/bash
it611062:1062::/home/it61:/bin/bash
it621063:1063::/home/it62:/bin/bash
it631064:1064::/home/it63:/bin/bash
it641065:1065::/home/it64:/bin/bash
it651066:1066::/home/it65:/bin/bash
it661067:1067::/home/it66:/bin/bash
it671068:1068::/home/it67:/bin/bash
it681069:1069::/home/it68:/bin/bash
it691070:1070::/home/it69:/bin/bash
it701071:1071::/home/it70:/bin/bash
it711072:1072::/home/it71:/bin/bash
it721073:1073::/home/it72:/bin/bash
it731074:1074::/home/it73:/bin/bash
it741075:1075::/home/it74:/bin/bash
it751076:1076::/home/it75:/bin/bash
it761077:1077::/home/it76:/bin/bash
it771078:1078::/home/it77:/bin/bash
it781079:1079::/home/it78:/bin/bash
it791080:1080::/home/it79:/bin/bash
it801081:1081::/home/it80:/bin/bash
it811082:1082::/home/it81:/bin/bash
it821083:1083::/home/it82:/bin/bash
it831084:1084::/home/it83:/bin/bash
it841085:1085::/home/it84:/bin/bash
it851086:1086::/home/it85:/bin/bash
it861087:1087::/home/it86:/bin/bash
it871088:1088::/home/it87:/bin/bash
it881089:1089::/home/it88:/bin/bash
it891090:1090::/home/it89:/bin/bash
it901091:1091::/home/it90:/bin/bash
it911092:1092::/home/it91:/bin/bash
it921093:1093::/home/it92:/bin/bash
it931094:1094::/home/it93:/bin/bash
it941095:1095::/home/it94:/bin/bash
it951096:1096::/home/it95:/bin/bash
it961097:1097::/home/it96:/bin/bash
it971098:1098::/home/it97:/bin/bash
it981099:1099::/home/it98:/bin/bash
it991100:1100::/home/it99:/bin/bash
it1001101:1101::/home/it100:/bin/bash
apache48:48:Apache:/usr/share/httpd:/bin/login
oldboy011102:1103::/home/oldboy01:/bin/bash
oldboy021103:1104::/home/oldboy02:/bin/bash
oldboy031104:1105::/home/oldboy03:/bin/bash
oldboy041105:1106::/home/oldboy04:/bin/bash
oldboy051106:1107::/home/oldboy05:/bin/bash
oldboy061107:1108::/home/oldboy06:/bin/bash
oldboy071108:1109::/home/oldboy07:/bin/bash
oldboy081109:1110::/home/oldboy08:/bin/bash
oldboy091110:1111::/home/oldboy09:/bin/bash
oldboy101111:1112::/home/oldboy10:/bin/bash
mailuser1112:1113::/home/mailuser:/bin/bash
oldboy1113:1114::/home/oldboy:/bin/bash
dhcpd177:177:DHCP server:/:/bin/login
geoclue998:996:User for geoclue:/var/lib/geoclue:/bin/login
打印/etc/passwd的奇数行?
sed 'n;d' /etc/passwd
[root@master passwd]# sed 'n;d' /etc/passwd
root0:0:root:/root:/bin/bash
daemon2:2:daemon:/sbin:/sbin/nologin
lp4:7:lp:/var/spool/lpd:/sbin/nologin
shutdown6:0:shutdown:/sbin:/sbin/shutdown
mail8:12:mail:/var/spool/mail:/sbin/nologin
games12games:/usr/games:/sbin/nologin
nobody99:99:Nobody:/:/sbin/nologin
dbus81:81:System message bus:/:/sbin/nologin
tss59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
sshd74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
systemd-network192:192:systemd Network Management:/:/sbin/nologin
it11002:1002::/home/it1:/bin/bash
it31004:1004::/home/it3:/bin/bash
it51006:1006::/home/it5:/bin/bash
it71008:1008::/home/it7:/bin/bash
it91010:1010::/home/it9:/bin/bash
it111012:1012::/home/it11:/bin/bash
it131014:1014::/home/it13:/bin/bash
it151016:1016::/home/it15:/bin/bash
it171018:1018::/home/it17:/bin/bash
it191020:1020::/home/it19:/bin/bash
it211022:1022::/home/it21:/bin/bash
it231024:1024::/home/it23:/bin/bash
it251026:1026::/home/it25:/bin/bash
it271028:1028::/home/it27:/bin/bash
it291030:1030::/home/it29:/bin/bash
it311032:1032::/home/it31:/bin/bash
it331034:1034::/home/it33:/bin/bash
it351036:1036::/home/it35:/bin/bash
it371038:1038::/home/it37:/bin/bash
it391040:1040::/home/it39:/bin/bash
it411042:1042::/home/it41:/bin/bash
it431044:1044::/home/it43:/bin/bash
it451046:1046::/home/it45:/bin/bash
it471048:1048::/home/it47:/bin/bash
it491050:1050::/home/it49:/bin/bash
it511052:1052::/home/it51:/bin/bash
it531054:1054::/home/it53:/bin/bash
it551056:1056::/home/it55:/bin/bash
it571058:1058::/home/it57:/bin/bash
it591060:1060::/home/it59:/bin/bash
it611062:1062::/home/it61:/bin/bash
it631064:1064::/home/it63:/bin/bash
it651066:1066::/home/it65:/bin/bash
it671068:1068::/home/it67:/bin/bash
it691070:1070::/home/it69:/bin/bash
it711072:1072::/home/it71:/bin/bash
it731074:1074::/home/it73:/bin/bash
it751076:1076::/home/it75:/bin/bash
it771078:1078::/home/it77:/bin/bash
it791080:1080::/home/it79:/bin/bash
it811082:1082::/home/it81:/bin/bash
it831084:1084::/home/it83:/bin/bash
it851086:1086::/home/it85:/bin/bash
it871088:1088::/home/it87:/bin/bash
it891090:1090::/home/it89:/bin/bash
it911092:1092::/home/it91:/bin/bash
it931094:1094::/home/it93:/bin/bash
it951096:1096::/home/it95:/bin/bash
it971098:1098::/home/it97:/bin/bash
it991100:1100::/home/it99:/bin/bash
apache48:48:Apache:/usr/share/httpd:/sbin/nologin
oldboy021103:1104::/home/oldboy02:/bin/bash
oldboy041105:1106::/home/oldboy04:/bin/bash
oldboy061107:1108::/home/oldboy06:/bin/bash
oldboy081109:1110::/home/oldboy08:/bin/bash
oldboy101111:1112::/home/oldboy10:/bin/bash
oldboy1113:1114::/home/oldboy:/bin/bash
geoclue998:996:User for geoclue:/var/lib/geoclue:/sbin/nologin
打印偶数行
sed 'n; d' /etc/passwd
[root@master passwd]# sed 'n; d' /etc/passwd
root0:0:root:/root:/bin/bash
daemon2:2:daemon:/sbin:/sbin/nologin
lp4:7:lp:/var/spool/lpd:/sbin/nologin
shutdown6:0:shutdown:/sbin:/sbin/shutdown
mail8:12:mail:/var/spool/mail:/sbin/nologin
games12games:/usr/games:/sbin/nologin
nobody99:99:Nobody:/:/sbin/nologin
dbus81:81:System message bus:/:/sbin/nologin
tss59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
sshd74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
systemd-network192:192:systemd Network Management:/:/sbin/nologin
it11002:1002::/home/it1:/bin/bash
it31004:1004::/home/it3:/bin/bash
it51006:1006::/home/it5:/bin/bash
it71008:1008::/home/it7:/bin/bash
it91010:1010::/home/it9:/bin/bash
it111012:1012::/home/it11:/bin/bash
it131014:1014::/home/it13:/bin/bash
it151016:1016::/home/it15:/bin/bash
it171018:1018::/home/it17:/bin/bash
it191020:1020::/home/it19:/bin/bash
it211022:1022::/home/it21:/bin/bash
it231024:1024::/home/it23:/bin/bash
it251026:1026::/home/it25:/bin/bash
it271028:1028::/home/it27:/bin/bash
it291030:1030::/home/it29:/bin/bash
it311032:1032::/home/it31:/bin/bash
it331034:1034::/home/it33:/bin/bash
it351036:1036::/home/it35:/bin/bash
it371038:1038::/home/it37:/bin/bash
it391040:1040::/home/it39:/bin/bash
it411042:1042::/home/it41:/bin/bash
it431044:1044::/home/it43:/bin/bash
it451046:1046::/home/it45:/bin/bash
it471048:1048::/home/it47:/bin/bash
it491050:1050::/home/it49:/bin/bash
it511052:1052::/home/it51:/bin/bash
it531054:1054::/home/it53:/bin/bash
it551056:1056::/home/it55:/bin/bash
it571058:1058::/home/it57:/bin/bash
it591060:1060::/home/it59:/bin/bash
it611062:1062::/home/it61:/bin/bash
it631064:1064::/home/it63:/bin/bash
it651066:1066::/home/it65:/bin/bash
it671068:1068::/home/it67:/bin/bash
it691070:1070::/home/it69:/bin/bash
it711072:1072::/home/it71:/bin/bash
it731074:1074::/home/it73:/bin/bash
it751076:1076::/home/it75:/bin/bash
it771078:1078::/home/it77:/bin/bash
it791080:1080::/home/it79:/bin/bash
it811082:1082::/home/it81:/bin/bash
it831084:1084::/home/it83:/bin/bash
it851086:1086::/home/it85:/bin/bash
it871088:1088::/home/it87:/bin/bash
it891090:1090::/home/it89:/bin/bash
it911092:1092::/home/it91:/bin/bash
it931094:1094::/home/it93:/bin/bash
it951096:1096::/home/it95:/bin/bash
it971098:1098::/home/it97:/bin/bash
it991100:1100::/home/it99:/bin/bash
apache48:48:Apache:/usr/share/httpd:/sbin/nologin
oldboy021103:1104::/home/oldboy02:/bin/bash
oldboy041105:1106::/home/oldboy04:/bin/bash
oldboy061107:1108::/home/oldboy06:/bin/bash
oldboy081109:1110::/home/oldboy08:/bin/bash
oldboy101111:1112::/home/oldboy10:/bin/bash
oldboy1113:1114::/home/oldboy:/bin/bash
geoclue998:996:User for geoclue:/var/lib/geoclue:/sbin/nologin
把/etc/httpd/conf/httpd.conf?件内的Linsten 80改为Listen 8081 sed 完成
sed -i 's/Listen 80/Listen 8081/g' /etc/httpd/conf/httpd.conf
```sh
sed -i 's/Listen 80/Listen 8081/g' /etc/httpd/conf/httpd.conf
1.sed查询信息
#01.根据文件内容的行号查询
sed -n '3p' person.txt --显示单行信息
sed -n '1,3p' person.txt --显示1-3行信息(连续)
sed -n '1p;3p' person.txt --显示第1、第3共两行(不连续)
[root@master ~]# sed -n '1,3p' person.txt
sdjfs
sdjkfhsjkd
dhfsdfsdfasfsdfsdddddddd
[root@master ~]# sed -n '3p' person.txt
dhfsdfsdfasfsdfsdddddddd
[root@master ~]# sed -n '1,3p' person.txt
sdjfs
sdjkfhsjkd
dhfsdfsdfasfsdfsdddddddd
[root@master ~]# sed -n '1p,3p' person.txt
#02.根据内容信息输出单行内容
sed -n '/test/p' person.txt --将含有test的行显示出来
sed -n '/test/,/Alex/p' person.txt --显示包含test到Alex行之间的所有行信息(连续)
sed -n '/test/p;/Alex/p' person.txt --只显示包含test、Alex的行
[root@master ~]# sed -n '/test/p' person.txt
stestfjkhskh
[root@master ~]# sed -n '/test/,/Alex/p' person.txt
stestfjkhskh
test
test
sdfsd
Alex
se
[root@master ~]# sed -n '/test/p;/Alex/p' person.txt
Alex
stestfjkhskh
test
test
Alex
2.sed命令增加信息(i:行前、a:行后)
sed '1iHelloworld' test.txt --在文件最前面增加一行Helloworld
sed '$abaibai' test.txt --在文件最后面增加一行baibai
sed '3afour' test.txt --在第三行后面增加一行four
sed '2itwo' test.txt --在第二行前面增加一行two
sed -e '/test/iqian' -e '/test/ahou' test.txt --在包含test行的前天增加一行qian,后面增加一行hou
sed '$a100\n101' test.txt --增加多行信息
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '1iHelloworld' test.txt
Helloworld
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '$abaibai' test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
baibai
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '3itwo' test.txt
Line 1
Line with test word
two
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '3afour' test.txt
Line 1
Line with test word
Line after the first test
four
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '2itwo' test.txt
Line 1
two
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed -e '/test/iqian' -e '/test/ahou' test.txt
Line 1
qian
Line with test word
hou
qian
Line after the first test
hou
Some other lines...
qian
Another line with test
hou
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '$a100\n101' test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
100
101
企业中编写配置文件:
IPaddress=10.10.10.1
mask=255.255.255.0
gateway=10.10.10.254
sed '$aIPaddress=10.10.10.1\nmask=255.255.255.0\ngateway=10.10.10.254' 文件名称
3.sed命令删除信息
sed '3d' test.txt --删除第3行(单行)
sed '2,6d' test.txt --删除第2-6行(连续行)
sed '3d;6d' test.txt --删除第3行和第6行
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '3d' test.txt
Line 1
Line with test word
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '2,6d' test.txt
Line 1
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '3d;6d' test.txt
Line 1
Line with test word
Some other lines...
Another line with test
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
如何利用sed命令取消空行显示?
sed -n '/./p' test.txt
sed '/^$/d' test.txt
sed -n '/^$/!p' test.txt
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed -n '/./p' test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed '/^$/d' test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# cat test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
[root@master ~]# sed -n '/^$/!p' test.txt
Line 1
Line with test word
Line after the first test
Some other lines...
Another line with test
More content here...
Final line
fgasg
fgasdgdf
dfgdfg
dfgasdg
fga
a
g
asg
gagadgadg
agas
4.sed命令修改信息
vim 替换: :%s#one#two#g
sed 's#要修改的内容#修改后的内容#g' test.txt
sed 's#one#two#g'
sed 's/#one/two/g' test.txt
后项引用前项进行替换修改
sed 's#()#\n#g' test.txt
ip a s eth0|sed -rn '3s#^.net(.)/24.*#\1#gp' --取出IP地址
sed -i.bak 's#one#two#g' test.txt --修改文件内容并自动备份
PS:在真实替换文件内容时候,一定不能让n和i参数同时出现
ni和参数同时使用,会将文件内容进行清空
grep 学习
几个特殊符号:
^ :以什么开头
$:以什么结尾
^$:空行
-v :取反
.:匹配只有一个字符
*:模糊查询
工作常用的参数
-c :匹配输出的行 计数
-i :不区分大小写
-n:显示行号
-v:取反
grep 笔试题实战分享
1 使用grep 取 passwd 显示行数
grep -c '' /etc/passwd
[root@master ~]# grep -c '' /etc/passwd
137
2 使用grep 取passwd 显示行号
grep -n ':' /etc/passwd
[root@master ~]# grep -n ':' /etc/passwd
1:root:x:0:0:root:/root:/bin/bash
2:bin:x:1:1:bin:/bin:/sbin/nologin
3:daemon:x:2:2:daemon:/sbin:/sbin/nologin
4:adm:x:3:4:adm:/var/adm:/sbin/nologin
5:lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
6:sync:x:5:0:sync:/sbin:/bin/sync
7:shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
8:halt:x:7:0:halt:/sbin:/sbin/halt
9:mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
10:operator:x:11:0:operator:/root:/sbin/nologin
11:games:x:12:100:games:/usr/games:/sbin/nologin
12:ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
13:nobody:x:99:99:Nobody:/:/sbin/nologin
14:avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
15:dbus:x:81:81:System message bus:/:/sbin/nologin
16:polkitd:x:999:998:User for polkitd:/:/sbin/nologin
17:tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
18:postfix:x:89:89::/var/spool/postfix:/sbin/nologin
19:sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
20:wang:x:1000:1000:wang:/home/wang:/bin/bash
21:systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
22:it101:x:1001:1001::/home/it101:/bin/bash
23:it1:x:1002:1002::/home/it1:/bin/bash
24:it2:x:1003:1003::/home/it2:/bin/bash
25:it3:x:1004:1004::/home/it3:/bin/bash
26:it4:x:1005:1005::/home/it4:/bin/bash
27:it5:x:1006:1006::/home/it5:/bin/bash
28:it6:x:1007:1007::/home/it6:/bin/bash
29:it7:x:1008:1008::/home/it7:/bin/bash
30:it8:x:1009:1009::/home/it8:/bin/bash
31:it9:x:1010:1010::/home/it9:/bin/bash
32:it10:x:1011:1011::/home/it10:/bin/bash
33:it11:x:1012:1012::/home/it11:/bin/bash
34:it12:x:1013:1013::/home/it12:/bin/bash
35:it13:x:1014:1014::/home/it13:/bin/bash
36:it14:x:1015:1015::/home/it14:/bin/bash
37:it15:x:1016:1016::/home/it15:/bin/bash
38:it16:x:1017:1017::/home/it16:/bin/bash
39:it17:x:1018:1018::/home/it17:/bin/bash
40:it18:x:1019:1019::/home/it18:/bin/bash
41:it19:x:1020:1020::/home/it19:/bin/bash
42:it20:x:1021:1021::/home/it20:/bin/bash
43:it21:x:1022:1022::/home/it21:/bin/bash
44:it22:x:1023:1023::/home/it22:/bin/bash
45:it23:x:1024:1024::/home/it23:/bin/bash
46:it24:x:1025:1025::/home/it24:/bin/bash
47:it25:x:1026:1026::/home/it25:/bin/bash
48:it26:x:1027:1027::/home/it26:/bin/bash
49:it27:x:1028:1028::/home/it27:/bin/bash
50:it28:x:1029:1029::/home/it28:/bin/bash
51:it29:x:1030:1030::/home/it29:/bin/bash
52:it30:x:1031:1031::/home/it30:/bin/bash
53:it31:x:1032:1032::/home/it31:/bin/bash
54:it32:x:1033:1033::/home/it32:/bin/bash
55:it33:x:1034:1034::/home/it33:/bin/bash
56:it34:x:1035:1035::/home/it34:/bin/bash
57:it35:x:1036:1036::/home/it35:/bin/bash
58:it36:x:1037:1037::/home/it36:/bin/bash
59:it37:x:1038:1038::/home/it37:/bin/bash
60:it38:x:1039:1039::/home/it38:/bin/bash
61:it39:x:1040:1040::/home/it39:/bin/bash
62:it40:x:1041:1041::/home/it40:/bin/bash
63:it41:x:1042:1042::/home/it41:/bin/bash
64:it42:x:1043:1043::/home/it42:/bin/bash
65:it43:x:1044:1044::/home/it43:/bin/bash
66:it44:x:1045:1045::/home/it44:/bin/bash
67:it45:x:1046:1046::/home/it45:/bin/bash
68:it46:x:1047:1047::/home/it46:/bin/bash
69:it47:x:1048:1048::/home/it47:/bin/bash
70:it48:x:1049:1049::/home/it48:/bin/bash
71:it49:x:1050:1050::/home/it49:/bin/bash
72:it50:x:1051:1051::/home/it50:/bin/bash
73:it51:x:1052:1052::/home/it51:/bin/bash
74:it52:x:1053:1053::/home/it52:/bin/bash
75:it53:x:1054:1054::/home/it53:/bin/bash
76:it54:x:1055:1055::/home/it54:/bin/bash
77:it55:x:1056:1056::/home/it55:/bin/bash
78:it56:x:1057:1057::/home/it56:/bin/bash
79:it57:x:1058:1058::/home/it57:/bin/bash
80:it58:x:1059:1059::/home/it58:/bin/bash
81:it59:x:1060:1060::/home/it59:/bin/bash
82:it60:x:1061:1061::/home/it60:/bin/bash
83:it61:x:1062:1062::/home/it61:/bin/bash
84:it62:x:1063:1063::/home/it62:/bin/bash
85:it63:x:1064:1064::/home/it63:/bin/bash
86:it64:x:1065:1065::/home/it64:/bin/bash
87:it65:x:1066:1066::/home/it65:/bin/bash
88:it66:x:1067:1067::/home/it66:/bin/bash
89:it67:x:1068:1068::/home/it67:/bin/bash
90:it68:x:1069:1069::/home/it68:/bin/bash
91:it69:x:1070:1070::/home/it69:/bin/bash
92:it70:x:1071:1071::/home/it70:/bin/bash
93:it71:x:1072:1072::/home/it71:/bin/bash
94:it72:x:1073:1073::/home/it72:/bin/bash
95:it73:x:1074:1074::/home/it73:/bin/bash
96:it74:x:1075:1075::/home/it74:/bin/bash
97:it75:x:1076:1076::/home/it75:/bin/bash
98:it76:x:1077:1077::/home/it76:/bin/bash
99:it77:x:1078:1078::/home/it77:/bin/bash
100:it78:x:1079:1079::/home/it78:/bin/bash
101:it79:x:1080:1080::/home/it79:/bin/bash
102:it80:x:1081:1081::/home/it80:/bin/bash
103:it81:x:1082:1082::/home/it81:/bin/bash
104:it82:x:1083:1083::/home/it82:/bin/bash
105:it83:x:1084:1084::/home/it83:/bin/bash
106:it84:x:1085:1085::/home/it84:/bin/bash
107:it85:x:1086:1086::/home/it85:/bin/bash
108:it86:x:1087:1087::/home/it86:/bin/bash
109:it87:x:1088:1088::/home/it87:/bin/bash
110:it88:x:1089:1089::/home/it88:/bin/bash
111:it89:x:1090:1090::/home/it89:/bin/bash
112:it90:x:1091:1091::/home/it90:/bin/bash
113:it91:x:1092:1092::/home/it91:/bin/bash
114:it92:x:1093:1093::/home/it92:/bin/bash
115:it93:x:1094:1094::/home/it93:/bin/bash
116:it94:x:1095:1095::/home/it94:/bin/bash
117:it95:x:1096:1096::/home/it95:/bin/bash
118:it96:x:1097:1097::/home/it96:/bin/bash
119:it97:x:1098:1098::/home/it97:/bin/bash
120:it98:x:1099:1099::/home/it98:/bin/bash
121:it99:x:1100:1100::/home/it99:/bin/bash
122:it100:x:1101:1101::/home/it100:/bin/bash
123:apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
124:oldboy01:x:1102:1103::/home/oldboy01:/bin/bash
125:oldboy02:x:1103:1104::/home/oldboy02:/bin/bash
126:oldboy03:x:1104:1105::/home/oldboy03:/bin/bash
127:oldboy04:x:1105:1106::/home/oldboy04:/bin/bash
128:oldboy05:x:1106:1107::/home/oldboy05:/bin/bash
129:oldboy06:x:1107:1108::/home/oldboy06:/bin/bash
130:oldboy07:x:1108:1109::/home/oldboy07:/bin/bash
131:oldboy08:x:1109:1110::/home/oldboy08:/bin/bash
132:oldboy09:x:1110:1111::/home/oldboy09:/bin/bash
133:oldboy10:x:1111:1112::/home/oldboy10:/bin/bash
134:mailuser:x:1112:1113::/home/mailuser:/bin/bash
135:oldboy:x:1113:1114::/home/oldboy:/bin/bash
136:dhcpd:x:177:177:DHCP server:/:/sbin/nologin
137:geoclue:x:998:996:User for geoclue:/var/lib/geoclue:/sbin/nologin
3 统计test信息在文件中出现了几次
grep -o "test" test.txt|grep -c "test"
grep -o "test" test.txt|wc -l
[root@master ~]# grep -o "test" test.txt|grep -c "test"
3
或者
[root@master ~]# grep -o "test" test.txt|wc -l
3
4 显示/etc/inittab中包含了:一个数字:(即两个冒号中间一个数字)的行
grep ':[0-9]:' /etc/inittab
命令 `grep ':[0-9]:' /etc/inittab` 的作用是在 `/etc/inittab` 文件中查找包含形如 `:数字:` 格式的行。具体来说,它会查找任何在冒号后面紧跟着一个或多个数字(范围从 0 到 9),再跟一个冒号的行。
例如,在 `/etc/inittab` 文件中,如果有这样的行:
```
tty1::respawn:/sbin/getty -L tty1 9600 vt100
id:3:initdefault:
```
那么该命令将会匹配到第二行,因为它包含了 `:3:` 这样的格式。
5 显示/etc/passwd中以nologin结尾的行
grep 'nologin$' /etc/passwd
grep 'nologin$' /etc/passwd
$ 结尾
^ :以什么开头
$:以什么结尾
^$:空行
-v :取反
.:匹配只有一个字符
*:模糊查询
6 显示 /etc/httpd/httpd.conf 注释的行取出来
grep -i '^#' /etc/httpd/httpd.conf
[root@master ~]# grep -i '^#' /etc/httpd/conf/httpd.conf
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so 'log/access_log'
# with ServerRoot set to '/www' will be interpreted by the
# server as '/www/log/access_log', where as '/log/access_log' will be
# interpreted as '/log/access_log'.
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used. If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#
# Relax access to content within /var/www.
#
# Further relax access to the default document root:
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
#
# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default. To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall may be used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults if commented: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
# Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.
七、awk(擅长统计分析文件内容 擅长对文件中列进行操作)
1)概念介绍
处理文件信息:
1.文本文件信息
2.日志文件信息
3.配置文件信息
处理文件方式:
- 排除信息
- 查询信息
- 统计信息
- 替换信息
语法格式:
awk [选项] '模式{动作}' [文件信息]
2)awk命令执行过程
3)awk命令的实际应用
awk系统的学习:重点学习
awk核心功能:日志处理 数据过滤 数据统计 取列
awk语法格式:
awk 参数 动作 文件
实战:
第一种
按照行号查询:
需求1:取第二行
sed -n 2p awk
awk 'NR==2' awk
[root@master ~]# cat awk
Zhang Dandan 41117397 :250:100:175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
Wu Waiwai 70271111 :250:80:75
Liu Bingbing 41117483 :250:100:175
root Xiaoai 3515064655 :50:95:135
Zi Gege 1986787350 :250:168:200
root Youjiu 918391635 :175:75:300
Lao Nanhai 918391635 :250:100:175
[root@master ~]# sed -n 2p awk
Zhang Xiaoyu 390320151 :155:90:201
[root@master ~]# awk 'NR==2' awk
Zhang Xiaoyu 390320151 :155:90:201
需求2: 取1-3行信息
awk 'NR1||NR3' awk
sed -n 1,3p awk
a=10 赋值一个变量
a==10 a等于2
[root@master ~]# awk 'NR==1||NR==3' awk
Zhang Dandan 41117397 :250:100:175
Meng Feixue 80042789 :250:60:50
[root@master ~]# sed -n 1,3p awk
Zhang Dandan 41117397 :250:100:175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
企业笔试题:训练
1.用awk 打印整个test.txt (以下操作都是用awk工具实现,针对test.txt)
awk '{print}' redis
[root@master ~]# cat redis
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
[root@master ~]# awk '{print}' redis
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
2.查找所有包含 ‘bash’ 的行
awk '/bash/' /etc/passwd
root@master ~]# awk '/bash/' /etc/passwd
root:x:0:0:root:/root:/bin/bash
wang:x:1000:1000:wang:/home/wang:/bin/bash
it101:x:1001:1001::/home/it101:/bin/bash
it1:x:1002:1002::/home/it1:/bin/bash
it2:x:1003:1003::/home/it2:/bin/bash
it3:x:1004:1004::/home/it3:/bin/bash
it4:x:1005:1005::/home/it4:/bin/bash
it5:x:1006:1006::/home/it5:/bin/bash
it6:x:1007:1007::/home/it6:/bin/bash
it7:x:1008:1008::/home/it7:/bin/bash
it8:x:1009:1009::/home/it8:/bin/bash
it9:x:1010:1010::/home/it9:/bin/bash
it10:x:1011:1011::/home/it10:/bin/bash
it11:x:1012:1012::/home/it11:/bin/bash
it12:x:1013:1013::/home/it12:/bin/bash
it13:x:1014:1014::/home/it13:/bin/bash
it14:x:1015:1015::/home/it14:/bin/bash
it15:x:1016:1016::/home/it15:/bin/bash
it16:x:1017:1017::/home/it16:/bin/bash
it17:x:1018:1018::/home/it17:/bin/bash
it18:x:1019:1019::/home/it18:/bin/bash
it19:x:1020:1020::/home/it19:/bin/bash
it20:x:1021:1021::/home/it20:/bin/bash
it21:x:1022:1022::/home/it21:/bin/bash
it22:x:1023:1023::/home/it22:/bin/bash
it23:x:1024:1024::/home/it23:/bin/bash
it24:x:1025:1025::/home/it24:/bin/bash
it25:x:1026:1026::/home/it25:/bin/bash
it26:x:1027:1027::/home/it26:/bin/bash
it27:x:1028:1028::/home/it27:/bin/bash
it28:x:1029:1029::/home/it28:/bin/bash
it29:x:1030:1030::/home/it29:/bin/bash
it30:x:1031:1031::/home/it30:/bin/bash
it31:x:1032:1032::/home/it31:/bin/bash
it32:x:1033:1033::/home/it32:/bin/bash
it33:x:1034:1034::/home/it33:/bin/bash
it34:x:1035:1035::/home/it34:/bin/bash
it35:x:1036:1036::/home/it35:/bin/bash
it36:x:1037:1037::/home/it36:/bin/bash
it37:x:1038:1038::/home/it37:/bin/bash
it38:x:1039:1039::/home/it38:/bin/bash
it39:x:1040:1040::/home/it39:/bin/bash
it40:x:1041:1041::/home/it40:/bin/bash
it41:x:1042:1042::/home/it41:/bin/bash
it42:x:1043:1043::/home/it42:/bin/bash
it43:x:1044:1044::/home/it43:/bin/bash
it44:x:1045:1045::/home/it44:/bin/bash
it45:x:1046:1046::/home/it45:/bin/bash
it46:x:1047:1047::/home/it46:/bin/bash
it47:x:1048:1048::/home/it47:/bin/bash
it48:x:1049:1049::/home/it48:/bin/bash
it49:x:1050:1050::/home/it49:/bin/bash
it50:x:1051:1051::/home/it50:/bin/bash
it51:x:1052:1052::/home/it51:/bin/bash
it52:x:1053:1053::/home/it52:/bin/bash
it53:x:1054:1054::/home/it53:/bin/bash
it54:x:1055:1055::/home/it54:/bin/bash
it55:x:1056:1056::/home/it55:/bin/bash
it56:x:1057:1057::/home/it56:/bin/bash
it57:x:1058:1058::/home/it57:/bin/bash
it58:x:1059:1059::/home/it58:/bin/bash
it59:x:1060:1060::/home/it59:/bin/bash
it60:x:1061:1061::/home/it60:/bin/bash
it61:x:1062:1062::/home/it61:/bin/bash
it62:x:1063:1063::/home/it62:/bin/bash
it63:x:1064:1064::/home/it63:/bin/bash
it64:x:1065:1065::/home/it64:/bin/bash
it65:x:1066:1066::/home/it65:/bin/bash
it66:x:1067:1067::/home/it66:/bin/bash
it67:x:1068:1068::/home/it67:/bin/bash
it68:x:1069:1069::/home/it68:/bin/bash
it69:x:1070:1070::/home/it69:/bin/bash
it70:x:1071:1071::/home/it70:/bin/bash
it71:x:1072:1072::/home/it71:/bin/bash
it72:x:1073:1073::/home/it72:/bin/bash
it73:x:1074:1074::/home/it73:/bin/bash
it74:x:1075:1075::/home/it74:/bin/bash
it75:x:1076:1076::/home/it75:/bin/bash
it76:x:1077:1077::/home/it76:/bin/bash
it77:x:1078:1078::/home/it77:/bin/bash
it78:x:1079:1079::/home/it78:/bin/bash
it79:x:1080:1080::/home/it79:/bin/bash
it80:x:1081:1081::/home/it80:/bin/bash
it81:x:1082:1082::/home/it81:/bin/bash
it82:x:1083:1083::/home/it82:/bin/bash
it83:x:1084:1084::/home/it83:/bin/bash
it84:x:1085:1085::/home/it84:/bin/bash
it85:x:1086:1086::/home/it85:/bin/bash
it86:x:1087:1087::/home/it86:/bin/bash
it87:x:1088:1088::/home/it87:/bin/bash
it88:x:1089:1089::/home/it88:/bin/bash
it89:x:1090:1090::/home/it89:/bin/bash
it90:x:1091:1091::/home/it90:/bin/bash
it91:x:1092:1092::/home/it91:/bin/bash
it92:x:1093:1093::/home/it92:/bin/bash
it93:x:1094:1094::/home/it93:/bin/bash
it94:x:1095:1095::/home/it94:/bin/bash
it95:x:1096:1096::/home/it95:/bin/bash
it96:x:1097:1097::/home/it96:/bin/bash
it97:x:1098:1098::/home/it97:/bin/bash
it98:x:1099:1099::/home/it98:/bin/bash
it99:x:1100:1100::/home/it99:/bin/bash
it100:x:1101:1101::/home/it100:/bin/bash
oldboy01:x:1102:1103::/home/oldboy01:/bin/bash
oldboy02:x:1103:1104::/home/oldboy02:/bin/bash
oldboy03:x:1104:1105::/home/oldboy03:/bin/bash
oldboy04:x:1105:1106::/home/oldboy04:/bin/bash
oldboy05:x:1106:1107::/home/oldboy05:/bin/bash
oldboy06:x:1107:1108::/home/oldboy06:/bin/bash
oldboy07:x:1108:1109::/home/oldboy07:/bin/bash
oldboy08:x:1109:1110::/home/oldboy08:/bin/bash
oldboy09:x:1110:1111::/home/oldboy09:/bin/bash
oldboy10:x:1111:1112::/home/oldboy10:/bin/bash
mailuser:x:1112:1113::/home/mailuser:/bin/bash
oldboy:x:1113:1114::/home/oldboy:/bin/bash
3 .用 ‘:’ 作为分隔符,查找第三段等于0的行
awk '$3==0' awk 空格分割
awk -F ":" '$3==0' awk 冒号分割
[root@master ~]# awk -F: '$3==0' /etc/passwd
root:x:0:0:root:/root:/bin/bash
4.用 ‘:’ 作为分隔符,查找第一段为 ‘root’ 的行,并把该段的 ‘root’ 换成 ‘toor’ (可以连同sed一起使用)
awk -F :'$1=="root"' awk |sed s/root/toor/g
注意:生产环境当中不要以命令为结尾生成文件 否则会出错
[root@master ~]# awk -F: '$1=="root"' /etc/passwd | sed 's/root/toor/g'
toor:x:0:0:toor:/toor:/bin/bash
5.用 ‘:’ 作为分隔符,打印最后一段
cat awk | awk -F ":" '{print $NF}'
[root@master ~]# cat /etc/passwd |awk -F ":" '{print $NF}'
/bin/bash
/sbin/nologin
/sbin/nologin
/sbin/nologin
/sbin/nologin
/bin/sync
/sbin/shutdown
/sbin/halt
/sbin/nologin
/sbin/nologin
/sbin/nologin
/sbin/nologin
/sbin/nologin
/sbin/nologin
/sbin/nologin
/sbin/nologin
/sbin/nologin
/sbin/nologin
/sbin/nologin
/bin/bash
/sbin/nologin
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/sbin/nologin
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/sbin/nologin
/sbin/nologin
笔试题:
取进程号和端口号:写出命令
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
答案如下:
16067 6403
16067 6403
16067 6403
16067 6403
答案:
cat redis | awk -F "[ :]+" '{print $2,$4}'
[root@master ~]# cat redis
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
work 16067 /data/svr/redis/bin/redis-server*:6403
[root@master ~]# cat redis | awk -F "[ :]+" '{print $2,$4}'
16067 6403
16067 6403
16067 6403
一、awk的实际操作过程
测试环境:
Zhang Dandan 41117397 :250175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
Wu Waiwai 70271111 :250:80:75
Liu Bingbing 41117483 :250175
Wang Xiaoai 3515064655 :50:95:135
Zi Gege 1986787350 :250:168:200
Li Youjiu 918391635 :175:75:300
Lao Nanhai 918391635 :250175
1.awk查询信息
#01.按照行号查询
awk 'NR==2' test.txt --显示第2行信息
awk 'NR2,NR4' test.txt --显示第2-4行信息
awk 'NR2;NR4' test.txt --显示第2行和第4行信息
[root@master ~]# cat test1.txt
Zhang Dandan 41117397 :250:100:175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
Wu Waiwai 70271111 :250:80:75
Liu Bingbing 41117483 :250:100:175
Wang Xiaoai 3515064655 :50:95:135
Zi Gege 1986787350 :250:168:200
Li Youjiu 918391635 :175:75:300
Lao Nanhai 918391635 :250:100:175
[root@master ~]# awk 'NR==2' test1.txt
[root@master ~]# awk 'NR==3' test1.txt
Zhang Xiaoyu 390320151 :155:90:201
[root@master ~]# awk 'NR==3,NR==6' test1.txt
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
[root@master ~]# awk 'NR==2;NR==4' test1.txt
[root@master ~]# awk 'NR==1;NR==5' test1.txt
Zhang Dandan 41117397 :250:100:175
Meng Feixue 80042789 :250:60:50
PS:在linux中
test=10 --赋值变量信息
test==10 --test等于10
#02.按照字符查询
awk '/one/' test.txt --显示含有字符one的行
awk '/one/,/three/' test.txt --显示含有字符one的行到含有three字符的行之间的所有行
awk '/one/;/three/' test.txt --显示含有字符one的行和含有字符three字符的行
[root@master ~]# cat test1.txt
Zhang Dandan 41117397 :250:100:175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
Wu Waiwai 70271111 :250:80:75
Liu Bingbing 41117483 :250:100:175
Wang Xiaoai 3515064655 :50:95:135
Zi Gege 1986787350 :250:168:200
Li Youjiu 918391635 :175:75:300
one
two
three sdkfs sdkfsdfjks dsfsdfjsj
sdkfshhsj
fssjks
sfj
one
sdkfhsk
sdfks
two
three dlsfjsdjfjas
Lao Nanhai 918391635 :250:100:175
[root@master ~]# awk '/one/' test1.txt
one
one
[root@master ~]# cat test1.txt
Zhang Dandan 41117397 :250:100:175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
Wu Waiwai 70271111 :250:80:75
Liu Bingbing 41117483 :250:100:175
Wang Xiaoai 3515064655 :50:95:135
Zi Gege 1986787350 :250:168:200
Li Youjiu 918391635 :175:75:300
one
two
three sdkfs sdkfsdfjks dsfsdfjsj
sdkfshhsj
fssjks
sfj
one
sdkfhsk
sdfks
two
three dlsfjsdjfjas
Lao Nanhai 918391635 :250:100:175
[root@master ~]# awk '/one/,/three/' test1.txt
one
two
three sdkfs sdkfsdfjks dsfsdfjsj
one
sdkfhsk
sdfks
two
three dlsfjsdjfjas
[root@master ~]# cat test1.txt
Zhang Dandan 41117397 :250:100:175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
Wu Waiwai 70271111 :250:80:75
Liu Bingbing 41117483 :250:100:175
Wang Xiaoai 3515064655 :50:95:135
Zi Gege 1986787350 :250:168:200
Li Youjiu 918391635 :175:75:300
one
two
three sdkfs sdkfsdfjks dsfsdfjsj
sdkfshhsj
fssjks
sfj
one
sdkfhsk
sdfks
two
three dlsfjsdjfjas
Lao Nanhai 918391635 :250:100:175
[root@master ~]# awk '/one/;/three/' test1.txt
one
three sdkfs sdkfsdfjks dsfsdfjsj
one
three dlsfjsdjfjas
显示xiaoyu的姓氏和ID号码
awk '/Xiaoyu/{print $1,$3}' test.txt
[root@master ~]# cat test1.txt
Zhang Dandan 41117397 :250:100:175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
Wu Waiwai 70271111 :250:80:75
Liu Bingbing 41117483 :250:100:175
Wang Xiaoai 3515064655 :50:95:135
Zi Gege 1986787350 :250:168:200
Li Youjiu 918391635 :175:75:300
one
two
three sdkfs sdkfsdfjks dsfsdfjsj
sdkfshhsj
fssjks
sfj
one
sdkfhsk
sdfks
two
three dlsfjsdjfjas
Lao Nanhai 918391635 :250:100:175
[root@master ~]# awk '/Xiaoyu/{print $1,$3}' test1.txt
Zhang 390320151
姓氏是zhang的人,显示他的第二次捐款金额及他的名字
awk '/Zhang/{print $NF}' test.txt|awk -F ":" '{print $3}' -F:指定分隔符
awk -F ":" '/^Zhang/{print $3}' test.txt
awk -F "[ :]+" '/^Zhang/{print $1,$2,$(NF-1)}' test.txt --以空格和冒号为分隔符
[root@master ~]# cat test1.txt
Zhang Dandan 41117397 :250:100:175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
Wu Waiwai 70271111 :250:80:75
Liu Bingbing 41117483 :250:100:175
Wang Xiaoai 3515064655 :50:95:135
Zi Gege 1986787350 :250:168:200
Li Youjiu 918391635 :175:75:300
one
two
three sdkfs sdkfsdfjks dsfsdfjsj
sdkfshhsj
fssjks
sfj
one
sdkfhsk
sdfks
two
three dlsfjsdjfjas
Lao Nanhai 918391635 :250:100:175
[root@master ~]# awk '/Zhang/{print $NF}' test1.txt|awk -F ":" '{print $3}'
100
90
[root@master ~]# awk -F ":" '/^Zhang/{print $3}' test1.txt
100
90
[root@master ~]# cat test1.txt
Zhang Dandan 41117397 :250:100:175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
Wu Waiwai 70271111 :250:80:75
Liu Bingbing 41117483 :250:100:175
Wang Xiaoai 3515064655 :50:95:135
Zi Gege 1986787350 :250:168:200
Li Youjiu 918391635 :175:75:300
one
two
three sdkfs sdkfsdfjks dsfsdfjsj
sdkfshhsj
fssjks
sfj
one
sdkfhsk
sdfks
two
three dlsfjsdjfjas
Lao Nanhai 918391635 :250:100:175
[root@master ~]# awk -F "[ :]" '/^Zhang/{print $1,$2,$(NF-1)}' test1.txt
Zhang Dandan 41117397 250 100
Zhang Xiaoyu 390320151 155 90
#03.显示所有以41开头的ID号码的人的全名和ID号码
awk '$3~/^41/{print $1,$2,$3}' test.txt --找出第三列以41开头的所有行,输出该行的1,2,3列信息
[root@master ~]# cat test1.txt
Zhang Dandan 41117397 :250:100:175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
Wu Waiwai 70271111 :250:80:75
Liu Bingbing 41117483 :250:100:175
Wang Xiaoai 3515064655 :50:95:135
Zi Gege 1986787350 :250:168:200
Li Youjiu 918391635 :175:75:300
one
two
three sdkfs sdkfsdfjks dsfsdfjsj
sdkfshhsj
fssjks
sfj
one
sdkfhsk
sdfks
two
three dlsfjsdjfjas
Lao Nanhai 918391635 :250:100:175
[root@master ~]# awk '$3-/^41/{print $1,$2,$3}' test1.txt
Zhang Dandan 41117397
Zhang Xiaoyu 390320151
Meng Feixue 80042789
Wu Waiwai 70271111
Liu Bingbing 41117483
Wang Xiaoai 3515064655
Zi Gege 1986787350
Li Youjiu 918391635
Lao Nanhai 918391635
文件中空行进行排除/文件中注释信息进行排除
grep -Ev "#|$" 文件信息
sed -n '/#|$/!p' 文件信息
awk '/#|$/' 文件信息
如何利用awk取出IP地址信息:
第一种:
ifconfig| grep inet| awk NR==2|awk '{print $2}'
第二种:
ifconfig| grep inet| head -1|awk '{print $2}'
第三种:
ifconfig| grep inet|sed -n 1p|awk '{print $2}'
第四种:
ifconfig| grep broadcast|awk '{print $2}'
第5种:hostname -i
第6种:ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'
[root@master ~]# ip a |awk '/inet / {print $2}'
127.0.0.1/8
10.0.0.164/24
[root@master ~]# ip a |grep -oP '(?<=inet\s)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d+'
127.0.0.1/8
10.0.0.164/24
[root@master ~]# ip a |sed -nE 's/.*inet ([0-9.]+)/\1/p'
127.0.0.1/8 scope host lo
10.0.0.164/24 brd 10.0.0.255 scope global dynamic eno16777736
[root@master ~]# ip a |grep -o 'inet [0-9.]*' |tr -d 'inet' |cut -d'/' -f1
127.0.0.1
10.0.0.164
[root@master ~]# ip a |grep -w inet |awk '{print $2}'
127.0.0.1/8
10.0.0.164/24
[root@master ~]# hostname -I
10.0.0.164
二、awk高级功能说明
普通的模式:
- 正则表达式作为模式
awk '/^oldboy/{print xx}'
- 利用比较匹配信息
NR==2
NR>=2
NR<=2
- NR2,NR10
特殊的模式
01.BEGIN{} 在awk执行命令前做什么事情:
awk 'BEGIN{print "姓","名","QQ号","捐款记录"}{print $0}' test.txt |column -t
姓 名 QQ号 捐款记录
Zhang Dandan 41117397 :250175
Zhang Xiaoyu 390320151 :155:90:201
Meng Feixue 80042789 :250:60:50
...
修改内置分隔符变量
awk -F ":" '{print $2}' test.txt
awk 'BEGIN{FS=":"}{print $2}' test.txt
02.END{} 在awk执行命令结束之后做的操作
awk 'BEGIN{print "姓","名","QQ号","捐款记录"}{print $0}END{print "操作结束"}' test.txt |column -t
姓 名 QQ号 捐款记录
Zhang Dandan 41117397 :250175
Zhang Xiaoyu 390320151 :155:90:201
...
操作结束
统计累加运算测试:
- 统计/etc/services文件中空行数量
利用awk公式进行累加运算
awk '/^$/{i=i+1;print i}' /etc/services
awk '/^$/{i=i+1}END{print i}' /etc/services --输出最终多少行
[root@master ~]# awk '/^$/{i=i+1;print i}' /etc/services
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@master ~]# awk '/^$/{i=i+1}END{print i}' /etc/services
17
- 统计/etc/services文件中有井号开头的行
awk '/^#/{i++}END{print i}' /etc/services 如果这样不好记 记下面的
grep ^# 也可以这样实现 这样比较简单
[root@master ~]# awk '/^#/{i++}END{print i}' /etc/services
102
[root@master ~]# grep -c '^#' /etc/services
102
- 统计系统中有多少个虚拟用户 普通用户
第一个历程: 用户信息都保存在什么文件中了
用户信息保存文件: /etc/passwd
第二个历程: 从文件中匹配出虚拟用户 普通用户
匹配普通用户
awk '$NF~/bash/' /etc/passwd
awk '$NF~//bin/bash/' /etc/passwd
[root@master ~]# awk '$NF-/bash/' /etc/services
# IANA services version: last updated 2013-04-10
# The Well Known Ports are those from 0 through 1023.
# The Registered Ports are those from 1024 through 49151
# The Dynamic and/or Private Ports are those from 49152 through 65535
echo 7/tcp
echo 7/udp
daytime 13/tcp
daytime 13/udp
ftp-data 20/tcp
ftp-data 20/udp
ftp 21/tcp
telnet 23/tcp
telnet 23/udp
nameserver 42/tcp name # IEN 116
nameserver 42/udp name # IEN 116
domain 53/udp
bootps 67/udp
tftp 69/tcp
tftp 69/udp
gopher 70/udp
finger 79/tcp
finger 79/udp
supdup 95/tcp
supdup 95/udp
rtelnet 107/udp
pop2 109/tcp pop-2 postoffice # POP version 2
pop3 110/tcp pop-3 # POP version 3
sftp 115/tcp
sftp 115/udp
uucp-path 117/tcp
uucp-path 117/udp
ntp 123/tcp
netbios-ns 137/udp
netbios-dgm 138/udp
netbios-ssn 139/udp
cmip-man 163/udp
cmip-agent 164/tcp
cmip-agent 164/udp
xdmcp 177/udp
bgp 179/udp
bgp 179/sctp
prospero 191/udp
irc 194/udp
smux 199/udp
at-rtmp 201/udp
at-nbp 202/udp
at-echo 204/udp
at-zis 206/udp
ipx 213/udp
rpc2portmap 369/tcp
codaauth2 370/tcp
ldap 389/tcp
ldap 389/udp
mobileip-agent 434/tcp
mobileip-agent 434/udp
mobilip-mn 435/tcp
mobilip-mn 435/udp
microsoft-ds 445/tcp
microsoft-ds 445/udp
photuris 468/tcp
photuris 468/udp
gss-http 488/tcp
gss-http 488/udp
pim-rp-disc 496/tcp
pim-rp-disc 496/udp
isakmp 500/tcp
isakmp 500/udp
iiop 535/tcp
iiop 535/udp
dhcpv6-client 546/tcp
dhcpv6-client 546/udp
dhcpv6-server 547/tcp
dhcpv6-server 547/udp
whoami 565/tcp
whoami 565/udp
acap 674/tcp
acap 674/udp
webster 765/udp
phonebook 767/udp
telnets 992/tcp
telnets 992/udp
exec 512/tcp
login 513/tcp
syslog 514/udp
talk 517/udp
ntalk 518/udp
efs 520/tcp
ripng 521/tcp
ripng 521/udp
netnews 532/tcp
ingreslock 1524/tcp
ingreslock 1524/udp
kermit 1649/tcp
kermit 1649/udp
h323gatedisc 1718/tcp
h323gatedisc 1718/udp
h323gatestat 1719/tcp
h323gatestat 1719/udp
h323hostcall 1720/tcp
h323hostcall 1720/udp
tftp-mcast 1758/tcp
tftp-mcast 1758/udp
hello 1789/tcp
hello 1789/udp
licensedaemon 1986/tcp
licensedaemon 1986/udp
dict 2628/tcp # RFC 2229
dict 2628/udp # RFC 2229
quake 26000/tcp
quake 26000/udp
wnn6-ds 26208/tcp
wnn6-ds 26208/udp
traceroute 33434/tcp
traceroute 33434/udp
rndc 953/tcp # rndc control sockets (BIND 9)
rndc 953/udp # rndc control sockets (BIND 9)
sgi-dgl 5232/udp
# Updated additional list from IANA with all missing services 04/07/2008
acr-nema 104/tcp # ACR-NEMA Digital Imag. & Comm. 300
acr-nema 104/udp # ACR-NEMA Digital Imag. & Comm. 300
matip-type-b 351/tcp bhoetty # MATIP Type B / bhoetty (added 5/21/97)
cloanto-net-1 356/tcp # Cloanto Net 1
cloanto-net-1 356/udp # Cloanto Net 1
ariel1 419/tcp # Ariel 1
ariel1 419/udp # Ariel 1
ariel2 421/tcp # Ariel 2
ariel2 421/udp # Ariel 2
ariel3 422/tcp # Ariel 3
ariel3 422/udp # Ariel 3
sco-websrvrmg3 598/tcp # SCO Web Server Manager 3
sco-websrvrmg3 598/udp # SCO Web Server Manager 3
dhcp-failover2 847/tcp # dhcp-failover 2
dhcp-failover2 847/udp # dhcp-failover 2
adobeserver-1 1102/tcp # ADOBE SERVER 1
adobeserver-1 1102/udp # ADOBE SERVER 1
adobeserver-2 1103/tcp # ADOBE SERVER 2
adobeserver-2 1103/udp # ADOBE SERVER 2
scanstat-1 1215/tcp # scanSTAT 1.0
scanstat-1 1215/udp # scanSTAT 1.0
etebac5 1216/tcp # ETEBAC 5
etebac5 1216/udp # ETEBAC 5
shockwave2 1257/tcp # Shockwave 2
shockwave2 1257/udp # Shockwave 2
dellwebadmin-1 1278/tcp # Dell Web Admin 1
dellwebadmin-1 1278/udp # Dell Web Admin 1
dellwebadmin-2 1279/tcp # Dell Web Admin 2
dellwebadmin-2 1279/udp # Dell Web Admin 2
sais 1426/tcp # Satellite-data Acquisition System 1
sais 1426/udp # Satellite-data Acquisition System 1
saism 1436/tcp # Satellite-data Acquisition System 2
saism 1436/udp # Satellite-data Acquisition System 2
saiscm 1501/tcp # Satellite-data Acquisition System 3
saiscm 1501/udp # Satellite-data Acquisition System 3
3l-l1 1511/tcp # 3l-l1
3l-l1 1511/udp # 3l-l1
3ds-lm 1538/tcp # 3ds-lm
3ds-lm 1538/udp # 3ds-lm
edb-server1 1635/tcp # EDB Server 1
edb-server1 1635/udp # EDB Server 1
saiseh 1644/tcp # Satellite-data Acquisition System 4
saiseh 1644/udp # Satellite-data Acquisition System 4
3Com-nsd 1742/tcp # 3Com-nsd
3Com-nsd 1742/udp # 3Com-nsd
canocentral1 1872/tcp # Cano Central 1
canocentral1 1872/udp # Cano Central 1
lipsinc1 1969/tcp # LIPSinc 1
lipsinc1 1969/udp # LIPSinc 1
descent3 2092/tcp # Descent 3
descent3 2092/udp # Descent 3
apc-2160 2160/tcp # APC 2160
apc-2160 2160/udp # APC 2160
apc-2161 2161/tcp # APC 2161
apc-2161 2161/udp # APC 2161
ddns-v3 2164/tcp # Dynamic DNS Version 3
ddns-v3 2164/udp # Dynamic DNS Version 3
apc-2260 2260/tcp # APC 2260
apc-2260 2260/udp # APC 2260
apx500api-1 2264/tcp # Audio Precision Apx500 API Port 1
apx500api-1 2264/udp # Audio Precision Apx500 API Port 1
apx500api-2 2265/tcp # Audio Precision Apx500 API Port 2
apx500api-2 2265/udp # Audio Precision Apx500 API Port 2
d2k-datamover1 2297/tcp # D2K DataMover 1
d2k-datamover1 2297/udp # D2K DataMover 1
d2k-datamover2 2298/tcp # D2K DataMover 2
d2k-datamover2 2298/udp # D2K DataMover 2
3d-nfsd 2323/tcp # 3d-nfsd
3d-nfsd 2323/udp # 3d-nfsd
ms-olap1 2393/tcp # MS OLAP 1
ms-olap1 2393/udp # MS OLAP 1
ms-olap2 2394/tcp # MS OLAP 2
ms-olap2 2394/udp # MS OLAP 2
worldfusion1 2595/tcp # World Fusion 1
worldfusion1 2595/udp # World Fusion 1
worldfusion2 2596/tcp # World Fusion 2
worldfusion2 2596/udp # World Fusion 2
firstcall42 2673/tcp # First Call 42
firstcall42 2673/udp # First Call 42
pn-requester2 2718/tcp # PN REQUESTER 2
pn-requester2 2718/udp # PN REQUESTER 2
cqg-netlan-1 2824/tcp # CQG Net/LAN 1
cqg-netlan-1 2824/udp # CQG Net/Lan 1
dialpad-voice1 2860/tcp # Dialpad Voice 1
dialpad-voice1 2860/udp # Dialpad Voice 1
dialpad-voice2 2861/tcp # Dialpad Voice 2
dialpad-voice2 2861/udp # Dialpad Voice 2
apc-3052 3052/tcp # APC 3052
apc-3052 3052/udp # APC 3052
jmq-daemon-1 3214/tcp # JMQ Daemon Port 1
jmq-daemon-1 3214/udp # JMQ Daemon Port 1
jmq-daemon-2 3215/tcp # JMQ Daemon Port 2
jmq-daemon-2 3215/udp # JMQ Daemon Port 2
4talk 3284/tcp # 4Talk
4talk 3284/udp # 4Talk
officelink2000 3320/tcp # Office Link 2000
officelink2000 3320/udp # Office Link 2000
tip2 3372/tcp # TIP 2
tip2 3372/udp # TIP 2
nokia-ann-ch1 3405/tcp # Nokia Announcement ch 1
nokia-ann-ch1 3405/udp # Nokia Announcement ch 1
nokia-ann-ch2 3406/tcp # Nokia Announcement ch 2
nokia-ann-ch2 3406/udp # Nokia Announcement ch 2
jaugsremotec-1 3472/tcp # JAUGS N-G Remotec 1
jaugsremotec-1 3472/udp # JAUGS N-G Remotec 1
jaugsremotec-2 3473/tcp # JAUGS N-G Remotec 2
jaugsremotec-2 3473/udp # JAUGS N-G Remotec 2
ibm3494 3494/tcp # IBM 3494
ibm3494 3494/udp # IBM 3494
apc-3506 3506/tcp # APC 3506
apc-3506 3506/udp # APC 3506
aairnet-1 3618/tcp # AAIR-Network 1
aairnet-1 3618/udp # AAIR-Network 1
aairnet-2 3619/tcp # AAIR-Network 2
aairnet-2 3619/udp # AAIR-Network 2
netplay-port1 3640/tcp # Netplay Port 1
netplay-port1 3640/udp # Netplay Port 1
netplay-port2 3641/tcp # Netplay Port 2
netplay-port2 3641/udp # Netplay Port 2
adobeserver-3 3703/tcp # Adobe Server 3
adobeserver-3 3703/udp # Adobe Server 3
adobeserver-4 3704/tcp # Adobe Server 4
adobeserver-4 3704/udp # Adobe Server 4
adobeserver-5 3705/tcp # Adobe Server 5
adobeserver-5 3705/udp # Adobe Server 5
edb-server2 3711/tcp # EBD Server 2
edb-server2 3711/udp # EBD Server 2
listcrt-port-2 3914/tcp # ListCREATOR Port 2
listcrt-port-2 3914/udp # ListCREATOR Port 2
ccu-comm-1 4053/tcp # CosmoCall Universe Communications Port 1
ccu-comm-1 4053/udp # CosmoCall Universe Communications Port 1
ccu-comm-2 4054/tcp # CosmoCall Universe Communications Port 2
ccu-comm-2 4054/udp # CosmoCall Universe Communications Port 2
ccu-comm-3 4055/tcp # CosmoCall Universe Communications Port 3
ccu-comm-3 4055/udp # CosmoCall Universe Communications Port 3
rfid-rp1 4684/tcp # RFID Reader Protocol 1.0
rfid-rp1 4684/udp # RFID Reader Protocol 1.0
smar-se-port1 4987/tcp # SMAR Ethernet Port 1
smar-se-port1 4987/udp # SMAR Ethernet Port 1
smar-se-port2 4988/tcp # SMAR Ethernet Port 2
smar-se-port2 4988/udp # SMAR Ethernet Port 2
avt-profile-1 5004/tcp # RTP media data [RFC 3551, RFC 4571]
avt-profile-1 5004/udp # RTP media data [RFC 3551]
avt-profile-2 5005/tcp # RTP control protocol [RFC 3551, RFC 4571]
avt-profile-2 5005/udp # RTP control protocol [RFC 3551]
intecom-ps1 5056/tcp # Intecom Pointspan 1
intecom-ps1 5056/udp # Intecom Pointspan 1
intecom-ps2 5057/tcp # Intecom Pointspan 2
intecom-ps2 5057/udp # Intecom Pointspan 2
ca-1 5064/tcp # Channel Access 1
ca-1 5064/udp # Channel Access 1
ca-2 5065/tcp # Channel Access 2
ca-2 5065/udp # Channel Access 2
i-net-2000-npr 5069/tcp # I/Net 2000-NPR
i-net-2000-npr 5069/udp # I/Net 2000-NPR
targus-getdata1 5201/tcp # TARGUS GetData 1
targus-getdata1 5201/udp # TARGUS GetData 1
targus-getdata2 5202/tcp # TARGUS GetData 2
targus-getdata2 5202/udp # TARGUS GetData 2
targus-getdata3 5203/tcp # TARGUS GetData 3
targus-getdata3 5203/udp # TARGUS GetData 3
3com-njack-1 5264/tcp # 3Com Network Jack Port 1
3com-njack-1 5264/udp # 3Com Network Jack Port 1
3com-njack-2 5265/tcp # 3Com Network Jack Port 2
3com-njack-2 5265/udp # 3Com Network Jack Port 2
netsupport2 5421/tcp # Net Support 2
netsupport2 5421/udp # Net Support 2
apc-5454 5454/tcp # APC 5454
apc-5454 5454/udp # APC 5454
apc-5455 5455/tcp # APC 5455
apc-5455 5455/udp # APC 5455
apc-5456 5456/tcp # APC 5456
apc-5456 5456/udp # APC 5456
tmosms1 5581/tcp # T-Mobile SMS Protocol Message 1
tmosms1 5581/udp # T-Mobile SMS Protocol Message 1
fac-restore 5582/tcp # T-Mobile SMS Protocol Message 3
fac-restore 5582/udp # T-Mobile SMS Protocol Message 3
tmo-icon-sync 5583/tcp # T-Mobile SMS Protocol Message 2
tmo-icon-sync 5583/udp # T-Mobile SMS Protocol Message 2
ida-discover1 5741/tcp # IDA Discover Port 1
ida-discover1 5741/udp # IDA Discover Port 1
ida-discover2 5742/tcp # IDA Discover Port 2
ida-discover2 5742/udp # IDA Discover Port 2
statsci1-lm 6144/tcp # StatSci License Manager - 1
statsci1-lm 6144/udp # StatSci License Manager - 1
statsci2-lm 6145/tcp # StatSci License Manager - 2
statsci2-lm 6145/udp # StatSci License Manager - 2
jeol-nsdtp-1 6241/tcp # JEOL Network Services Data Transport Protocol 1
jeol-nsddp-1 6241/udp # JEOL Network Services Dynamic Discovery Protocol 1
jeol-nsdtp-2 6242/tcp # JEOL Network Services Data Transport Protocol 2
jeol-nsddp-2 6242/udp # JEOL Network Services Dynamic Discovery Protocol 2
jeol-nsdtp-3 6243/tcp # JEOL Network Services Data Transport Protocol 3
jeol-nsddp-3 6243/udp # JEOL Network Services Dynamic Discovery Protocol 3
jeol-nsdtp-4 6244/tcp # JEOL Network Services Data Transport Protocol 4
jeol-nsddp-4 6244/udp # JEOL Network Services Dynamic Discovery Protocol 4
emp-server1 6321/tcp # Empress Software Connectivity Server 1
emp-server1 6321/udp # Empress Software Connectivity Server 1
emp-server2 6322/tcp # Empress Software Connectivity Server 2
emp-server2 6322/udp # Empress Software Connectivity Server 2
apc-6547 6547/tcp # APC 6547
apc-6547 6547/udp # APC 6547
apc-6548 6548/tcp # APC 6548
apc-6548 6548/udp # APC 6548
apc-6549 6549/tcp # APC 6549
apc-6549 6549/udp # APC 6549
watchme-7272 7272/tcp # WatchMe Monitoring 7272
watchme-7272 7272/udp # WatchMe Monitoring 7272
itactionserver1 7280/tcp # ITACTIONSERVER 1
itactionserver1 7280/udp # ITACTIONSERVER 1
itactionserver2 7281/tcp # ITACTIONSERVER 2
itactionserver2 7281/udp # ITACTIONSERVER 2
apc-7845 7845/tcp # APC 7845
apc-7845 7845/udp # APC 7845
apc-7846 7846/tcp # APC 7846
apc-7846 7846/udp # APC 7846
rtsp-alt 8554/tcp # RTSP Alternate (see port 554)
rtsp-alt 8554/udp # RTSP Alternate (see port 554)
canon-bjnp1 8611/tcp # Canon BJNP Port 1
canon-bjnp1 8611/udp # Canon BJNP Port 1
canon-bjnp2 8612/tcp # Canon BJNP Port 2
canon-bjnp2 8612/udp # Canon BJNP Port 2
canon-bjnp3 8613/tcp # Canon BJNP Port 3
canon-bjnp3 8613/udp # Canon BJNP Port 3
canon-bjnp4 8614/tcp # Canon BJNP Port 4
canon-bjnp4 8614/udp # Canon BJNP Port 4
ddi-tcp-1 8888/tcp # NewsEDGE server TCP (TCP 1)
ddi-udp-1 8888/udp # NewsEDGE server UDP (UDP 1)
ddi-tcp-2 8889/tcp # Desktop Data TCP 1
ddi-tcp-3 8890/tcp # Desktop Data TCP 2
jmb-cds1 8900/tcp # JMB-CDS 1
jmb-cds1 8900/udp # JMB-CDS 1
jmb-cds2 8901/tcp # JMB-CDS 2
jmb-cds2 8901/udp # JMB-CDS 2
swa-1 9023/tcp # Secure Web Access - 1
swa-1 9023/udp # Secure Web Access - 1
swa-2 9024/tcp # Secure Web Access - 2
swa-2 9024/udp # Secure Web Access - 2
swa-3 9025/tcp # Secure Web Access - 3
swa-3 9025/udp # Secure Web Access - 3
swa-4 9026/tcp # Secure Web Access - 4
swa-4 9026/udp # Secure Web Access - 4
swtp-port1 9281/tcp # SofaWare transport port 1
swtp-port1 9281/udp # SofaWare transport port 1
swtp-port2 9282/tcp # SofaWare transport port 2
swtp-port2 9282/udp # SofaWare transport port 2
apc-9950 9950/tcp # APC 9950
apc-9950 9950/udp # APC 9950
apc-9951 9951/tcp # APC 9951
apc-9951 9951/udp # APC 9951
apc-9952 9952/tcp # APC 9952
apc-9952 9952/udp # APC 9952
acis 9953/tcp # 9953
acis 9953/udp # 9953
sua 14001/udp # De-Registered (2001 June 06)
sage-best-com1 14033/tcp # sage Best! Config Server 1
sage-best-com1 14033/udp # sage Best! Config Server 1
sage-best-com2 14034/tcp # sage Best! Config Server 2
sage-best-com2 14034/udp # sage Best! Config Server 2
optohost002 22002/tcp # Opto Host Port 2
optohost002 22002/udp # Opto Host Port 2
optohost003 22003/tcp # Opto Host Port 3
optohost003 22003/udp # Opto Host Port 3
optohost004 22004/tcp # Opto Host Port 4
optohost004 22004/udp # Opto Host Port 4
optohost005 22005/tcp # Opto Host Port 5
optohost005 22005/udp # Opto Host Port 5
inovaport1 23000/tcp # Inova LightLink Server Type 1
inovaport1 23000/udp # Inova LightLink Server Type 1
inovaport2 23001/tcp # Inova LightLink Server Type 2
inovaport2 23001/udp # Inova LightLink Server Type 2
inovaport3 23002/tcp # Inova LightLink Server Type 3
inovaport3 23002/udp # Inova LightLink Server Type 3
inovaport4 23003/tcp # Inova LightLink Server Type 4
inovaport4 23003/udp # Inova LightLink Server Type 4
inovaport5 23004/tcp # Inova LightLink Server Type 5
inovaport5 23004/udp # Inova LightLink Server Type 5
inovaport6 23005/tcp # Inova LightLink Server Type 6
inovaport6 23005/udp # Inova LightLink Server Type 6
vista-4gl 24249/tcp # Vista 4GL
vista-4gl 24249/udp # Vista 4GL
sgsap 29118/sctp # SGsAP in 3GPP
sbcap 29168/sctp # SBcAP in 3GPP
pago-services1 30001/tcp # Pago Services 1
pago-services1 30001/udp # Pago Services 1
pago-services2 30002/tcp # Pago Services 2
pago-services2 30002/udp # Pago Services 2
autotrac-acp 31020/tcp # Autotrac ACP 245
[root@master ~]# awk '$NF-/\/bin\/bash/' /etc/passwd
root:x:0:0:root:/root:/bin/bash
wang:x:1000:1000:wang:/home/wang:/bin/bash
it101:x:1001:1001::/home/it101:/bin/bash
it1:x:1002:1002::/home/it1:/bin/bash
it2:x:1003:1003::/home/it2:/bin/bash
it3:x:1004:1004::/home/it3:/bin/bash
it4:x:1005:1005::/home/it4:/bin/bash
it5:x:1006:1006::/home/it5:/bin/bash
it6:x:1007:1007::/home/it6:/bin/bash
it7:x:1008:1008::/home/it7:/bin/bash
it8:x:1009:1009::/home/it8:/bin/bash
it9:x:1010:1010::/home/it9:/bin/bash
it10:x:1011:1011::/home/it10:/bin/bash
it11:x:1012:1012::/home/it11:/bin/bash
it12:x:1013:1013::/home/it12:/bin/bash
it13:x:1014:1014::/home/it13:/bin/bash
it14:x:1015:1015::/home/it14:/bin/bash
it15:x:1016:1016::/home/it15:/bin/bash
it16:x:1017:1017::/home/it16:/bin/bash
it17:x:1018:1018::/home/it17:/bin/bash
it18:x:1019:1019::/home/it18:/bin/bash
it19:x:1020:1020::/home/it19:/bin/bash
it20:x:1021:1021::/home/it20:/bin/bash
it21:x:1022:1022::/home/it21:/bin/bash
it22:x:1023:1023::/home/it22:/bin/bash
it23:x:1024:1024::/home/it23:/bin/bash
it24:x:1025:1025::/home/it24:/bin/bash
it25:x:1026:1026::/home/it25:/bin/bash
it26:x:1027:1027::/home/it26:/bin/bash
it27:x:1028:1028::/home/it27:/bin/bash
it28:x:1029:1029::/home/it28:/bin/bash
it29:x:1030:1030::/home/it29:/bin/bash
it30:x:1031:1031::/home/it30:/bin/bash
it31:x:1032:1032::/home/it31:/bin/bash
it32:x:1033:1033::/home/it32:/bin/bash
it33:x:1034:1034::/home/it33:/bin/bash
it34:x:1035:1035::/home/it34:/bin/bash
it35:x:1036:1036::/home/it35:/bin/bash
it36:x:1037:1037::/home/it36:/bin/bash
it37:x:1038:1038::/home/it37:/bin/bash
it38:x:1039:1039::/home/it38:/bin/bash
it39:x:1040:1040::/home/it39:/bin/bash
it40:x:1041:1041::/home/it40:/bin/bash
it41:x:1042:1042::/home/it41:/bin/bash
it42:x:1043:1043::/home/it42:/bin/bash
it43:x:1044:1044::/home/it43:/bin/bash
it44:x:1045:1045::/home/it44:/bin/bash
it45:x:1046:1046::/home/it45:/bin/bash
it46:x:1047:1047::/home/it46:/bin/bash
it47:x:1048:1048::/home/it47:/bin/bash
it48:x:1049:1049::/home/it48:/bin/bash
it49:x:1050:1050::/home/it49:/bin/bash
it50:x:1051:1051::/home/it50:/bin/bash
it51:x:1052:1052::/home/it51:/bin/bash
it52:x:1053:1053::/home/it52:/bin/bash
it53:x:1054:1054::/home/it53:/bin/bash
it54:x:1055:1055::/home/it54:/bin/bash
it55:x:1056:1056::/home/it55:/bin/bash
it56:x:1057:1057::/home/it56:/bin/bash
it57:x:1058:1058::/home/it57:/bin/bash
it58:x:1059:1059::/home/it58:/bin/bash
it59:x:1060:1060::/home/it59:/bin/bash
it60:x:1061:1061::/home/it60:/bin/bash
it61:x:1062:1062::/home/it61:/bin/bash
it62:x:1063:1063::/home/it62:/bin/bash
it63:x:1064:1064::/home/it63:/bin/bash
it64:x:1065:1065::/home/it64:/bin/bash
it65:x:1066:1066::/home/it65:/bin/bash
it66:x:1067:1067::/home/it66:/bin/bash
it67:x:1068:1068::/home/it67:/bin/bash
it68:x:1069:1069::/home/it68:/bin/bash
it69:x:1070:1070::/home/it69:/bin/bash
it70:x:1071:1071::/home/it70:/bin/bash
it71:x:1072:1072::/home/it71:/bin/bash
it72:x:1073:1073::/home/it72:/bin/bash
it73:x:1074:1074::/home/it73:/bin/bash
it74:x:1075:1075::/home/it74:/bin/bash
it75:x:1076:1076::/home/it75:/bin/bash
it76:x:1077:1077::/home/it76:/bin/bash
it77:x:1078:1078::/home/it77:/bin/bash
it78:x:1079:1079::/home/it78:/bin/bash
it79:x:1080:1080::/home/it79:/bin/bash
it80:x:1081:1081::/home/it80:/bin/bash
it81:x:1082:1082::/home/it81:/bin/bash
it82:x:1083:1083::/home/it82:/bin/bash
it83:x:1084:1084::/home/it83:/bin/bash
it84:x:1085:1085::/home/it84:/bin/bash
it85:x:1086:1086::/home/it85:/bin/bash
it86:x:1087:1087::/home/it86:/bin/bash
it87:x:1088:1088::/home/it87:/bin/bash
it88:x:1089:1089::/home/it88:/bin/bash
it89:x:1090:1090::/home/it89:/bin/bash
it90:x:1091:1091::/home/it90:/bin/bash
it91:x:1092:1092::/home/it91:/bin/bash
it92:x:1093:1093::/home/it92:/bin/bash
it93:x:1094:1094::/home/it93:/bin/bash
it94:x:1095:1095::/home/it94:/bin/bash
it95:x:1096:1096::/home/it95:/bin/bash
it96:x:1097:1097::/home/it96:/bin/bash
it97:x:1098:1098::/home/it97:/bin/bash
it98:x:1099:1099::/home/it98:/bin/bash
it99:x:1100:1100::/home/it99:/bin/bash
it100:x:1101:1101::/home/it100:/bin/bash
oldboy01:x:1102:1103::/home/oldboy01:/bin/bash
oldboy02:x:1103:1104::/home/oldboy02:/bin/bash
oldboy03:x:1104:1105::/home/oldboy03:/bin/bash
oldboy04:x:1105:1106::/home/oldboy04:/bin/bash
oldboy05:x:1106:1107::/home/oldboy05:/bin/bash
oldboy06:x:1107:1108::/home/oldboy06:/bin/bash
oldboy07:x:1108:1109::/home/oldboy07:/bin/bash
oldboy08:x:1109:1110::/home/oldboy08:/bin/bash
oldboy09:x:1110:1111::/home/oldboy09:/bin/bash
oldboy10:x:1111:1112::/home/oldboy10:/bin/bash
mailuser:x:1112:1113::/home/mailuser:/bin/bash
oldboy:x:1113:1114::/home/oldboy:/bin/bash
第三个历程: 进行统计
求和运算:
sum=sum+$n(需要进行数值求和的列)
seq 10|awk '{sum=sum+$1;print sum}'
[root@master ~]# seq 10|awk '{sum=sum+$1;print sum}'
1
3
6
10
15
21
28
36
45
55
总结:awk命令中$符号用法
$1 $2 $3 : 取第几列信息
$NF : 取最后一列
$(NF-n) : 取倒数第几列
$0 : 取所有列的信息
三剑客命令
老三: grep 过滤筛选信息
老二: sed 修改替换文件内容 擅长对文件中的行进行操作
老大: awk 擅长统计分析文件内容 擅长对文件中列进行操作
find、grep、sed、awk命令(总结)的更多相关文章
- Shell学习:grep, sed, awk命令的练习题
http://www.cnblogs.com/chengmo/archive/2013/01/17/2865479.html 文件:datafileSteve Blenheim:238-923-736 ...
- grep/sed/awk命令查看指定时间段的日志
*grep命令 今天遇到研发要求查询定时任务(elastic-job)在14:00-14:40的日志,使用grep命令很方便: 命令: grep '时间' '日志文件名 ' 1.例如查询2020-02 ...
- Linux三剑客grep/sed/awk
grep/sed/awk被称为linux的“三剑客” grep更适合单纯的查找或匹配文本: sed更适合编辑匹配到的文本: awk更适合格式化文本,对文本进行较复杂各式处理: Grep --color ...
- day60:Linux压缩与打包&用户管理&用户提权sudo&grep,sed,awk,sort,uniq
目录 1.文件管理-压缩与打包 2.用户管理 用户怎么查 如何创建用户 创建的用户信息都存储在哪? 用户存储密码的文件 如何为用户设定密码? 3.用户组 4.用户提权相关 5.Extra:额外补充 文 ...
- linux三剑客grep|sed|awk实践
最好先学习正则表达式的基本用法,以及正则表达式BREs,EREs,PREs的区别 此坑待填 grep sed awk
- grep sed awk 3个Linux中对文件内容操作的命令
在学习Linux命令中,发现3个有关于文件内容操作的命令grep,sed和awk,在这里简单汇总这3个命令主要作用,在实际中找到最合适的情景应用,详细用法可以参考其他文章. 1.grep命令 主要作用 ...
- 5_find grep sed awk 详解
find :查找文件系统中指定的文件.可以按文件名(-name) 权限(-perm) 归属人 查找. find 要查找文件的路径 表达式 *通配符 可以添加在文件名的任意位置 常用的例子( ...
- 【Linux】 字符串和文本处理工具 grep & sed & awk
Linux字符串&文本处理工具 因为用linux的时候主要用到的还是字符交互界面,所以对字符串的处理变得十分重要.这篇介绍三个常用的字符串处理工具,包括grep,sed和awk ■ grep ...
- [svc]linux正则实战(grep/sed/awk)
企业实战: 过滤ip 过滤出第二行的 192.168.2.11. eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ine ...
- linux grep sed awk
$ grep ‘test’ d* 显示所有以d开头的文件中包含 test的行. $ grep ‘test’ aa bb cc 显示在aa,bb,cc文件中匹配test的行. $ grep ‘[a-z] ...
随机推荐
- C# 二十年语法变迁之 C# 2,C# 3 ,C# 4参考
C# 二十年语法变迁之 C# 2,C# 3 ,C# 4参考 https://benbowen.blog/post/two_decades_of_csharp_i/ 自从 C# 于 2000 年推出以来 ...
- UVALive7146 Defeat the Enemy
题目链接 题目 见链接. 题解 知识点:贪心,STL. 首先要保证我方军队能消灭对方军队才行,因此只要我们按攻击力从大到小排,对方按防御力从大到小排,从大到小遍历,用我方所有攻击力大于敌方目前防御力军 ...
- NC50439 tokitsukaze and Soldier
题目链接 题目 题目描述 在一个游戏中,tokitsukaze需要在n个士兵中选出一些士兵组成一个团去打副本. 第i个士兵的战力为v[i],团的战力是团内所有士兵的战力之和. 但是这些士兵有特殊的要求 ...
- Activiti7 多实例子流程
顾名思义,子流程是一个包含其他活动.网关.事件等的活动,这些活动本身形成了一个流程,该流程是更大流程的一部分. 使用子流程确实有一些限制: 一个子流程只能有一个none类型的启动事件,不允许有其他类型 ...
- Ubuntu下通过Wine安装LTSpice 17.1.8
LTSpice LTSpice 是常用的电路模拟软件, 但是只有 Windows 版本和 Mac 版本, 在 Linux 下需要用 Wine 运行. 以下说明如何在 Ubuntu 下安装最新的 LTS ...
- SPA单页应用的优缺点
SPA单页应用的优缺点 Single Page Web Application是一种特殊的Web应用,其所有的活动局限于一个Web页面中,仅在该Web页面初始化时加载相应的HTML.JavaScrip ...
- springboot项目读取自定义的properties文件
现在我们要在某个地方读取config.properties里的这几个属性值 这里使用三个注解即可读取自定义的配置文件内容(注意这里需要写他的setter和getter方法) @Component #注 ...
- Java序列化(Serializable)与反序列化详解
什么是序列化? Java序列化是在JDK 1.1中引入的,是Java内核的重要特性之一. Java序列化API允许我们将一个对象转换为流,并通过网络发送,或将其存入文件或数据库以便未来使用, 反序列化 ...
- 《系列一》-- 2、XmlBeanFactory 的类图介绍.md
阅读之前要注意的东西:本文就是主打流水账式的源码阅读,主导的是一个参考,主要内容需要看官自己去源码中验证.全系列文章基于 spring 源码 5.x 版本. Spring源码阅读系列--全局目录.md ...
- java+mysql数据库实现的学生管理系统
说明: java+mysql数据库实现的学生管理系统 功能 实现增加学生.删除学生.修改学生.学生列表.查询学生功能 截图: 开发工具/技术 java eclipse 价格:50元,有需要联系 微信 ...