Hope this is of assistance...
Expanding the grep
a bit to give more information in the output, for example, to get the line number in the file where the text is can be done as follows:
find . -type f -name "*.*" -print0 | xargs --null grep --with-filename --line-number --no-messages --color --ignore-case "searthtext"
And if you have an idea what the file type is you can narrow your search down by specifying file type extensions to search for, in this case .pas
OR .dfm
files:
find . -type f \( -name "*.pas" -o -name "*.dfm" \) -print0 | xargs --null grep --with-filename --line-number --no-messages --color --ignore-case "searchtext"
Short explanation of the options:
.
in the find
specifies from the current directory.
-name
"*.*
" : for all files
( -name "*.pas
" -o -name "*.dfm
" ) : Only the *.pas
OR *.dfm
files, OR specified with -o
-type f
specifies that you are looking for files
-print0
and --null
on the other side of the |
(pipe) are the crucial ones, passing the filename from the find
to the grep
embedded in the xargs
, allowing for the passing of filenames WITH spaces in the filenames, allowing grep to treat the path and filename as one string, and not break it up on each space.