I have a directory full of .tsv files and I want to run a grep command on each of them to pull out a certain group of text lines and then save it to an associated text file with a similar file name. So for example, if I was grepping just one of the files, my grep command looks like this:
grep -h 8-K 2008-QTR1.tsv > 2008Q1.txt
But I have a list of tsv files that look like:
2008-QTR1.tsv 2008-QTR2.tsv 2008-QTR3.tsv 2008-QTR4.tsv 2009-QTR1.tsv 2009-QTR2.tsv 2009-QTR3.tsv ...
And after grepping they need to be stored as:
2008Q1.txt 2008Q2.txt 2008Q3.txt 2008Q4.txt 2009Q1.txt 2009Q2.txt 2009Q3.txt