Find all files with the extension .txt in the directory ~/dir1/dir2 and execute the command sed to append the contents of each file to the file ~/dir1/log/file.log.
find ~/dir1/dir2 -name '*.txt' -exec sed -i -e 's/$/ &gt;&gt; ~/dir1/log/file.log/' {} \;