1.^含义
linux正则表达式^表示行首字符,例如,^word表示待搜索的字符串(word)在行首
2.样例
正则表达式^样例
命令:
grep -n "^#" anaconda-ks.cfg
表示搜索行首为#开始的那一行
[root@elasticsearch ~]# grep -n "^#" anaconda-ks.cfg
1:#version=DEVEL
2:# System authorization information
4:# Use CDROM installation media
6:# Use graphical install
8:# Run the Setup Agent on first boot
11:# Keyboard layouts
13:# System language
16:# Network information
20:# Root password
22:# System services
24:# System timezone
26:# System bootloader configuration
29:# Partition clearing information
[root@elasticsearch ~]#
本文介绍了Linux中正则表达式^的含义,即匹配行首字符,通过grep命令的-n选项展示如何在`anaconda-ks.cfg`文件中搜索以#开头的行。例子详细列出了配置文件中被匹配的行。
7918

被折叠的 条评论
为什么被折叠?



