1 、显示/proc/meminfo 文件中以大小s 开头的行( 要求:使用两
种方法)
grep "^[sS]" /proc/meminfo
grep -i "^[s]" /proc/meminfo
grep -e "^s" -e "^S" /proc/meminfo
grep "^\(s\|S\)" /proc/meminfo
2 、显示/etc/passwd 文件中不以/bin/bash 结尾的行
grep -v "/bin/bash$" /etc/passwd
3 、显示用户rpc 默认的shell 程序
grep "^rpc\>" /etc/passwd|cut -d: -f7
4 、找出/etc/passwd 中的两位或三位数
grep -o "[[:digit:]]\{
2,3\}" /etc/passwd
5 、显示CentOS7 的/etc/grub2.cfg 文件中,至少以一个空白
字符开头的且后面存非空白字符的行
grep "^[<