Differences
This shows you the differences between two versions of the page.
grep [2014/03/28 16:35] |
grep [2014/03/28 16:35] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== grep ====== | ||
+ | * [[ack]] | ||
+ | * [[sed]] | ||
+ | |||
+ | * **-x** - Select only those matches that exactly match the whole line. | ||
+ | |||
+ | == Check if a line exists == | ||
+ | |||
+ | Returns 0 or 1 exit codes | ||
+ | |||
+ | <code> | ||
+ | cat filelist | grep -xq string | ||
+ | </code> | ||
+ | |||
+ | == Return line number == | ||
+ | |||
+ | <code> | ||
+ | cat filelist -n string | ||
+ | </code> |