Find all files in the current directory (and its subdirectories) with a ".txt" extension, and execute a command to add the text "This was added by a random command." to the end of each file.
find ./ -name "*.txt" -exec sed -i -e 's/$/ This was added by a random command./' {} \;