9951 explained code solutions for 126 technologies

grepShow only first result when searching text in files

grep -m 1 'text' *.txt | head -1ctrl + c
-m 1

stop searching current file after first match


text to search


search in all txt files of current dir

head -1

will print only first found result (replace 1 with any number of results you want to have)