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
file1.txt:
file2.txt:
This command will extract the tags and their enclosed strings:
output.txt:
Extra cookie for your pleasure:
This command will do something similar, but will display only sorted unique records, and they occurrences (for statistics purpose):
output.txt: