How can we append text in a file via a one-line command without using io redirection?
You can use the --append
feature of tee
:
cat file01.txt | tee --append bothFiles.txt
cat file02.txt | tee --append bothFiles.txt
Or shorter,
cat file01.txt file02.txt | tee --append bothFiles.txt
I assume the request for no redirection (>>
) comes from the need to use this in xargs
or similar. So if that doesn't count, you can mute the output with >/dev/null
.