1.1 Overview
grep is used primarily to find the lines of a keyword match
1.2 Basic syntax
1.2.1 Syntax
[[email protected] ~]# grep [parameters] Configuration mode file
1.2.2 Parameters
[[email protected] ~]# grep [parameters] Configuration mode file
Parameters
-I: Ignore case
-V: Take the inverse match
-W: Match word
--color Display Color
1.3 grep uses
[[email protected] ~]# grep root/etc/passwd filter out the root row in the passwd file
Root:x:0:0:root:/root:/bin/bash
Operator:x:11:0:operator:/root:/sbin/nologin
[[email protected] ~]# grep--color root/etc/passwd matching keywords display color
root: x:0:0:root:/root:/bin/bash
operator:x:11:0:operator:/root:/sbin/nologin
[[email protected] ~]# grep-v root/etc/passwd Match Results reversed
Bin:x:1:1:bin:/bin:/sbin/nologin
Daemon:x:2:2:daemon:/sbin:/sbin/nologin
This article is from the "Lao Han Technical Note" blog, please be sure to keep this source http://hzyan.blog.51cto.com/9617993/1586571
Filter the Three Musketeers for grep topics