Find a word or phrase in files within a directory with a single command.
grep -rn <PATTERN> <DIR_PATH>
Arguments:
| # | Name | Description |
|---|---|---|
| --- | ------ | ------------- |
| 1 | PATTERN | Text or pattern to search for |
| 2 | DIR_PATH | Directory to search in |
grep -rn "TODO" /home/user/project
Output:
/home/user/project/main.py:12:# TODO: fix this
/home/user/project/utils.py:5:# TODO: add tests
Format: FILENAME:LINE_NUMBER:MATCHING_LINE
共 1 个版本