Tutorial by Examples

The search pattern can also be a regular expression. Running: grep '^[A-Z]' someFile.txt When someFile.txt contains: fred 14 m foo sam 68 m bar christina 83 f baz bob 22 m qux Sam 41 m quux Will produce the output: Sam 41 m quux since this is the only line in someFile.txt starting wi...
Given the following file: hello how are you i am fine let's go, you! let's go, baby! grep with look-behind allows to print only some parts: $ grep -Po "(?<=let's go, ).*" file you! baby! In this case, it matches what occurs after "let's go, ".

Page 1 of 1