To open files found with grep in Sublime Text, run the following command subl $(grep -irl “search for text” .) Where i = case insensitive r = recursive l = only file names Be sure to include the l flag, otherwise you’ll open a bunch of new files with no relation to what you’re […]
Grep count all occurrences found
You can use Grep to count all occurrences of a string with the following cat * | grep -c [search] .
Grep list only unique filenames
To list unique filenames using grep, do the following: grep -irl “search-term” . Notice the ‘l’ flag, short for –files-with-matches, defined as “Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match.” The i flag just makes […]