I want to run find -name with multiple file types. Eg.
find -name *.h,*.cpp
Is this possible?
The grep command searches through the file, looking for matches to the pattern specified. To use it type grep , then the pattern we're searching for and finally the name of the file (or files) we're searching in. The output is the three lines in the file that contain the letters 'not'.
Click My PC on the left-pane in File Explorer, or Computer in Windows Explorer. Enter the command kind:=picture into the search box to search all partitions on your hard drive for images saved in JPEG, PNG, GIF and BMP formats.
$ find . -name '*.h' -o -name '*.cpp'
To find this information in the man
page, type man find
and the search for operators by typing /OPERATORS
and hit enter.
The .
isn't strictly necessary with GNU find, but is necessary in Unix. The quotes are important in either case, and leaving them out will cause errors if files of those types appear in the current directory.
On some systems (such as Cygwin), parentheses are necessary to make the set of extensions inclusive:
$ find . \( -name '*.h' -o -name '*.cpp' \)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With