using grep to find the file name pertaining to content searched
this may not be platform agnostic, but heres the scenario:
you have a bunch of source files and you want to identify which one follows a search fed into grep.
you can either parse each file using a loop in your shell using shell script, or, you can use the -l switch!
the grep command reads and parses data, and outputs it in a stream
simply change the directory your to the directory of the source files, and do:
$ grep 'string_to_search_for' *
or you can very well do
$ grep 'string_to_search_for' ~/.src/git/emacs/src/*
be sure to replace string_to_search_for with your own string!
which should return stuff like
xwidget.c: return XCAR (XCDR (tail));
xwidget.c is the name of the file, there IS a tab, and theres the line of code that registeres with grep!
for the code snippet above, i searched for 'return'.
now this is a powerful, powerful feature in grep and with shell scripts, piping, and argument macros (such as $1) you can save a ton of time in shell scripting.
i personally feel this method of searching source files along with scripting, piping, argument macros, and other means of scripting are *critical* to securing and validating code, especially when it comes to computer security
im also doing a writeup of gtk4, that should come sometime soon, maybe within 3 or 4 days!
happy coding!!
unidef