I'm trying to avoid the creation of a temp file (in the example t12.txt
) using some bash tricks, to no avail.
Suppose two files t1.txt
and t2.txt
, with some text lines.
Example of a command working:
$ cat t1.txt t2.txt > t12.txt
$ tac t2.txt t1.txt | tac | diff - t12.txt
Now I'm trying to avoid the creation of t12.txt using anything, from pipes to weird redirects.
Commands I tried in different orders and tests are things like: $(cat t1.txt t2.txt)
or < <(cat t1.txt t2.txt)
.
Any creative suggestion here? Ty.
This should do the job:
diff <(cat t1.txt t2.txt) <(tac t2.txt t1.txt)
This just creates temporary file descriptors at /dev/fd
for the outputs of cat t1.txt t2.txt
and tac t2.txt t1.txt
respectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With