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 ~]#