[root@centos7 temp]# grep root /etc/passwd root:x:0:0:root:/root:/bin/bash operator:x:11:0:operator:/root:/sbin/nologin
[root@centos7 temp]# cat /etc/passwd | grep root root:x:0:0:root:/root:/bin/bash operator:x:11:0:operator:/root:/sbin/nologin
[root@centos7 temp]# cat /etc/passwd | grep root /etc/passwd - /etc/passwd:root:x:0:0:root:/root:/bin/bash /etc/passwd:operator:x:11:0:operator:/root:/sbin/nologin (标准输入):root:x:0:0:root:/root:/bin/bash (标准输入):operator:x:11:0:operator:/root:/sbin/nologin
[root@centos7 temp]# grep "^root" /etc/passwd /etc/group /etc/passwd:root:x:0:0:root:/root:/bin/bash /etc/group:root:x:0:
[root@centos7 temp]# grep "/bin/bash$" /etc/passwd root:x:0:0:root:/root:/bin/bash learner:x:1000:1000::/home/learner:/bin/bash
[root@centos7 temp]# grep "^[^a-s]" /etc/passwd tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin tcpdump:x:72:72::/:/sbin/nologin
[root@centos7 temp]# grep "0\{3,\}" /etc/passwd
learner:x:1000:1000::/home/learner:/bin/bash
[root@centos7 temp]# grep "^[r,l]" /etc/passwd root:x:0:0:root:/root:/bin/bash lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin learner:x:1000:1000::/home/learner:/bin/bash
[root@centos7 temp]# grep -i abcd file
ABCD
function abcd() {
[root@centos7 temp]#
[root@centos7 temp]# grep -oi abcd file ABCD abcd [root@centos7 temp]#
[root@centos7 temp]# grep -oic abcd file 2 [root@centos7 temp]#
[root@centos7 temp]# grep -v "/sbin/nologin$" /etc/passwd root:x:0:0:root:/root:/bin/bash sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt learner:x:1000:1000::/home/learner:/bin/bash
[root@centos7 temp]# cat test
abcd
ABCD
[root@centos7 temp]# grep -f test file
ABCD
function abcd() {
[root@centos7 temp]#
[root@centos7 temp]# grep -xf test file ABCD [root@centos7 temp]#
[root@centos7 temp]# grep here file here there [root@centos7 temp]# grep -w here file here [root@centos7 temp]#
[root@centos7 temp]# cat /etc/passwd|grep ^root - /etc/passwd -h root:x:0:0:root:/root:/bin/bash root:x:0:0:root:/root:/bin/bash
[root@centos7 temp]# grep -n "^[r,l]" /etc/passwd 1:root:x:0:0:root:/root:/bin/bash 5:lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin 24:learner:x:1000:1000::/home/learner:/bin/bash
-A N 表示输出匹配行和其之后(after)的N行 -B N 表示输出匹配行和其之前(before)的N行 -C N 表示输出匹配行和其之前之后各N行 [root@centos7 temp]# grep -A 2 ^operator /etc/passwd operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin [root@centos7 temp]# grep -B2 ^operator /etc/passwd halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin [root@centos7 temp]# grep -C1 ^operator /etc/passwd mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin
[root@centos7 temp]# grep -F ^root /etc/passwd [root@centos7 temp]#
[root@centos7 temp]# egrep "^root|^learner" /etc/passwd root:x:0:0:root:/root:/bin/bash learner:x:1000:1000::/home/learner:/bin/bash
[root@centos7 ~]# echo "helloworld123456"| grep -oP "\d+" 123456 [root@centos7 ~]#
[root@centos7 ~]# grep -a online /usr/bin/ls %s online help: <%s> [root@centos7 ~]#
[root@centos7 temp]# find . -type f | xargs grep --exclude=*.txt --include=test* bash ./test.sh:#!/bin/bash [root@centos7 temp]#
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有