I am performing some operations using the grep, sed, and cut commands on a Linux machinete:
zgrep -A1 "^module" *.v.gz | sed -n -e 's/^\(module \)*\(.*(.*)\).*$/\2/p' | cut -f1 -d"("
This is being run on files with the extension .v.gz and I want the output files to have a .txt extension instead.
For example, input filename:
abcd.v.gz
efgh.v.gz
ijkl.v.gz
mnop.v.gz
output filename
abcd.txt
efgh.txt
ijkl.txt
mnop.txt
So I want to keep the same file name prefix, but change the extension. How can I do this for an arbitrary number of files?