What is the difference between these command:
find . –type f –name \'*txt*\'
and
find . –type f | grep \'txt\'
In your first example, you are using the find
utility to list the filenames of regular files where the filename includes the string txt
.
In your second example, you are using the find
utility to list the filenames of regular files and feeding the resultant filenames via a pipe to the grep
utility which searches the contents of each file for the string txt
. Each time the string is found, the corresponding line of the file is outputted.