Let's say I have files: foo.tsv
and bar.tsv
, whose contents are shown below:
foo.tsv
1
2
3
4
5
bar.tsv
a
b
c
d
e
If I run paste foo.tsv bar.tsv > foo_bar.tsv
I get:
foo_bar.tsv
1 a
2 b
3 c
4 d
5 e
Though this is very nice, I'd like to automatically name foo_bar.tsv
to eliminate the possibility of ending up with a misleading file, e.g., in case of typos.
Let's say:
paste foo.tsv baz.tsv > foo_bar.tsv # foo_bar should have been foo_baz here.
In the simple case of 2 inputs is hard to get something wrong, but if I do:
paste foo.tsv baz.tsv bar.tsv baz.tsv > foo_baz_bar_baz.tsv
things are likely to get messy.
Is there a way of automatically naming the output file? How can I make the redirection operator aware of its inputs?!