grep的通配符搜索使用通配符符号的grep
我有一个包含许多IP地址的文件。我想列出文件中的所有IP地址,并使用格式192.16 *的grep,但它不显示整个IP地址列表。我只能列出整个IP地址,而使用周期后跟星号符号。所以我的疑问是为什么第二选项不工作,但第三选项正常工作。
[email protected]:~/test# cat z
192.168.1.0
192.168.2.0
192.168.110.7
192.168.115.5
1. [email protected]:~/test# grep -o 192.1 z
192.1
192.1
192.1
192.1
2. [email protected]:~/test# grep -o 192.1* z
192.1
192.1
192.1
192.1
3. [email protected]:~/test# grep -o 192.1. z
192.16
192.16
192.16
192.16
4. [email protected]:~/test# grep -o 192.1.* z
192.168.1.0
192.168.2.0
192.168.110.7
192.168.115.5
我想你想的grep'192 \ .1 z' – Jahid