You can also open multiple files in cat
and redirect the output to a new file. Since the names of multiple files would be returned by find
, you can use that inside cat
using `
(backtick):
cat `find . -name "configuration_dev.txt"` > testing.txt
Command between backticks would be executed and replaced by the output of the command removing the trailing new line character and inserting a whitespace.
You can confirm this by running
A=`find . -name "configuration_dev.txt"`
echo $A
As you'll find that the output would be something like:
./tmp/configuration/configuration_dev.txt ./tmp/configuration/configuration_dev.txt
Thus the actual cat
command under the hood will be:
cat ./tmp/configuration/configuration_dev.txt ./tmp/configuration/configuration_dev.txt > testing.txt
cat
command which takefind
output, and do a redirect to a.txt
file with>
operand