Skip to content

Commit 0bedac9

Browse files
committed
Adding an example
1 parent 73d0de4 commit 0bedac9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/patterns.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ Some common examples of regular expressions:
176176
- **|** This wildcard makes a logical OR relationship between wildcards. You can thus search something or something else. You may need to add a '\' before this command to avoid the shell thinking you want a pipe.
177177
- **[^]** This is the equivalent of [!] in standard wildcards, i.e. it is a logical “not” and will match anything not listed within the square brackets.
178178

179+
!!! note "Advanced example"
180+
181+
This command searches the file `myfile` for lines starting with an “s” and ending with an “n”, and prints them to the standard output.
182+
183+
```bash
184+
$ cat myfile | grep '^s.*n$'
185+
```
186+
187+
Remember to not include the first `$` if you copy the command! It is the prompt!
188+
179189
!!! note "Keypoints"
180190

181191
- Finding files with specific patterns in their names or content can be done with ``grep`` and ``find``

0 commit comments

Comments
 (0)