1. Using a regular match file name
# # grep-n ' [^\/][a-za-z0-9]*[.a-za-z0-9][a-za-z0-9]*$ ' Regular_express.txt
/etc/init.d/hello.h
/etc/init.d/hehe
2. Using SED to extract the NIC IP
(1)
# ifconfig eth0 |grep ' inet addr '
inet addr:192.168.211.129 bcast:192.168.211.255 mask:255.255.255.0
(2)
# ifconfig eth0 |grep ' inet addr ' | Sed ' s/^.*addr://g '
192.168.211.129 bcast:192.168.211.255 mask:255.255.255.0
(3)
# ifconfig eth0 |grep ' inet addr ' | Sed ' s/^.*addr://g ' | Sed ' s/bcast.*$//g '
192.168.211.129
3.
(1) filter ' man '
# cat/etc/man.config |grep-n ' man '
(2) Replace the contents of the sentence that begins with # with an empty
# cat/etc/man.config |grep-n ' man ' | Sed ' s/#.*$//g '
11:
17:
18:
19:
39:
41:
43:manpath/usr/man
44:manpath/usr/share/man
45:manpath/usr/local/man
46:manpath/usr/local/share/man
47:manpath/usr/x11r6/man
(3) Delete empty lines
# cat/etc/man.config |grep ' man ' |sed ' s/#.*$//g ' | Sed '/^$/d '
Manpath/usr/man
Manpath/usr/share/man
Manpath/usr/local/man
Manpath/usr/local/share/man
Manpath/usr/x11r6/man
Linux regular match Little note