How would you merge different input .txt and .tsv files (within a directory) who have the same name but a different extension into an output file?
ext='(txt|tsv|text|log)' for f (**/*.$~ext(.)) cat < $f >> $f:t:r.merged
The order of merging will be alphabetical within a same directory. That is,
a/file.txt will be included before
Also note that hidden files (those whose name starts with
.) won't be considered (add the
D glob qualifier if you want them).