1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-19 21:35:31 +02:00

fgrep: add page (#4001)

This commit is contained in:
César Soto Valero 2020-04-23 21:18:23 +02:00 committed by GitHub
parent 8beb491d91
commit 01e670afed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

28
pages/common/fgrep.md Normal file
View file

@ -0,0 +1,28 @@
# fgrep
> Matches patterns in files.
> Supports simple patterns and regular expressions.
- Search for an exact string in a file:
`fgrep {{search_string}} {{path/to/file}}`
- Search only lines that match entirely in files:
`fgrep -x {{path/to/file1}} {{path/to/file2}}`
- Count the number of lines that match the given string in a file:
`fgrep -c {{search_string}} {{path/to/file}}`
- Show the line number in the file along with the line matched:
`fgrep -n {{search_string}} {{path/to/file}}`
- Display all lines except those that contain the given regular expression:
`fgrep -v {{^regex$}} {{path/to/file}}`
- Display filenames whose content matchs the regular expression at least once:
`fgrep -l {{^regex$}} {{path/to/file1}} {{path/to/file2}}`