Lets say a directory has two files. Here are the contents
File1.txt
tagstart random string tagend
tagstart random string tagend
File2.txt
tagstart random string tagend
tagstart random string tagend
I want to grep the directory and extract the lines that have the following pattern
tagstart <any string> tagend
I also want to pipe the output to another file. Basically the grep command will result in an output file like this
out.txt
tagstart random string tagend
tagstart random string tagend
tagstart random string tagend
tagstart random string tagend