Reputation: 1
In a react project, I want to search for the case insensitive word "tolowercase" in all /src directories and only search in *.js files.
Upvotes: 0
Views: 699
Reputation: 38942
Use
grep -RHlie tolowercase --include '*.js' /src
The options are elaborated on from running man grep
:
-R, -r, --recursive
Recursively search subdirectories listed.
-H Always print filename headers with output lines.
-l, --files-with-matches
Only the names of files containing selected lines are written to
standard output. grep will only search a file until a match has
been found, making searches potentially less expensive. Path-
names are listed once per file searched. If the standard input
is searched, the string ``(standard input)'' is written.
-i, --ignore-case
Perform case insensitive matching. By default, grep is case sen-
sitive.
-e pattern, --regexp=pattern
Specify a pattern used during the search of the input: an input
line is selected if it matches any of the specified patterns.
This option is most useful when multiple -e options are used to
specify multiple patterns, or when a pattern begins with a dash
(`-').
Upvotes: 2