?linux基础命令 grep

时间:2021-02-26 15:48:30   收藏:0   阅读:38
根据内容过滤文本信息
grep
[root@rstx-201 ~]# grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash
operator:x:11:0:operator:/root:/sbin/nologin

加上通配符^  以root开头
grep ^root /etc/passwd
root:x:0:0:root:/root:/bin/bash

加上通配符$  以bash结尾
grep bash$ /etc/passwd
root:x:0:0:root:/root:/bin/bash
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
yangtao:x:1001:1001::/home/yangtao:/bin/bash

原文:https://www.cnblogs.com/yangtao416/p/14452283.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!