To view a list of files that meet certain criteria, simply run your file viewing program with the file names as arguments. Shells substitute a command enclosed in backquotes with its output, so the whole command looks like this:
less `find /usr/include -name '*.h' | xargs grep -l mode_t`
You can edit those files by giving an editor name instead of a file viewing program:
emacs `find /usr/include -name '*.h' | xargs grep -l mode_t`
Because there is a limit to the length of any individual command line, there is a limit to the number of files that can be handled in this way. We can get around this difficulty by using xargs like this:
find /usr/include -name '*.h' | xargs grep -l mode_t > todo xargs --arg-file=todo emacs
Here, xargs
will run emacs
as many times as necessary to
visit all of the files listed in the file todo.