User Tools

Site Tools


grep:basic_usage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
grep:basic_usage [2020/08/22 10:59] 192.168.1.1grep:basic_usage [2020/08/22 11:02] (current) 192.168.1.1
Line 140: Line 140:
 The result in this example will print nothing, because there are no lines that only contain the pattern **boo**. The result in this example will print nothing, because there are no lines that only contain the pattern **boo**.
 </WRAP> </WRAP>
 +
 +----
 +
 +===== Add additional lines of context =====
 +
 +<code bash>
 +grep -A2 "mach" filename
 +</code>
 +
 +returns:
 +
 +<code bash>
 +machine
 +boots
 +bungie
 +</code>
 +
 +<WRAP info>
 +**NOTE:**  The **A** option will print out the search string plus a number of additional lines.
 +
 +In this example 2 additional lines.
 +</WRAP>
 +
  
grep/basic_usage.1598093968.txt.gz · Last modified: 2020/08/22 10:59 by 192.168.1.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki