I need to search through a folder of files and copy all text that begins with a variable.
So for example:
Files A.txt,B.txt,C.txt, and D.txt contain the strings "Hello1", "Hello2", "Hello3", and "Hello4" respectively. I need to be able to search for all words that begin with "Hello" and output the result.
In this particular case A.txt,B.txt,C.txt, and D.txt would be searched and the output would be
Hello1 Hello2 Hello3 Hello4
I've looked around and found the following which allows me to export all files containing the text, however I'm not sure how or if this can be adapted for what I need.
grep -l Hello *.txt