grep -vE '^$|#' /usr/local/etc/zabbix_agentd.conf
> -E
> -q
> -m10
> -c
> -P
> -w
> -x
https://blog.csdn.net/yongan1006/article/details/8134401
-A:显示匹配后和它后面的几行
-B:显示匹配前和它前面的几行
-C:显示匹配前后各几行
cut -d ":" -f1 /etc/passwd
-d: 分隔符
-f: 第几列
-b: 默认输出第一个数字字母
a=(11 22 33)
echo ${a[0]}
echo ${a[*]}
echo ${a[@]}
^ $
[],[^]
. :匹配任意单个字符
* :匹配前一个字符任意次数【*不能单独使用】可以是0次
\{n,m\} : 匹配n到m次,\代表取消转义,屏蔽
\{n\} : 精确匹配n次
\{n,\} : 至少n次
\{\} :保留
+ 最少匹配一次(1或n)
? 最多匹配一次(0或1)
{n,m} 匹配n到m次
() 组合为整体,保留
| 或者
\b\b 单词边界
或 \<word\>
\b或\> word\b word\>
> grep 'ba\{3,5\}' 1.txt
> egrep '(ba)\{3,5\}' 1.txt
1.txt
I cat't finsh the test.
Oh! The soup taste good.
grep 't{ae}st' 1.txt
grep 't{ae}st.' 1.txt
grep 't{ae}st.*' 1.txt
grep 't{ae}ste*' 1.txt
grep 't{ae}ste\{0,1\}' 1.txt
egrep '^1[0-9]{10}$' tel.txt
$代表以最后一位结尾
cp /etc/vsftpd/vsftpd.conf{,.bak}
*:匹配任意长度的任意字符
?:匹配任意单个字符
[]:匹配指定范围内的任意单个字符
[^]:匹配指定范围之外的任意单个字符
[:space:]:空白字符
[:punct:]:标点符号
[:lower:]:小写字母
[:upper:]:大写字母
[:alpha:]:大小写字母
[:digit:]:数字
[:alnum:]:数字和大小写字母