Find all lines matching text
11 March 2022 (Updated 11 March 2022)
Find all lines matching text
grep -rin "127.0.0.1" $HOME/sites
This will recursively search the path $HOME/sites
and print all the lines that match the text 127.0.0.1
.
- -R, -r, –recursive Read all files under each directory, recursively; this is equivalent to the -d recurse option.
- -i, –ignore-case Ignore case distinctions in both the PATTERN and the input files. (-i is specified by POSIX.)
- -n, –line-number Prefix each line of output with the 1-based line number within its input file. (-n is specified by POSIX.)
- grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (–) is given as file name) for lines containing a match to the given PATTERN. By default, grep prints the matching line
Tagged:
Unix
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment