|
appending a line to the end of several hundred files
I have a bunch of files named publish.php within subdirs. I need to append a line at the end of each file. I thought I could do it with find and echo like this:
Code:
find . -name publish.php -exec echo "<? include('path/to/file.php'); ?>" >> '{}' \;
but that appends the line to a file named {} instead of the find results.
I've also tried this:
Code:
echo "<? include('path/to/file.php'); ?>" >> $(find . -name publish.php)
but bash throws an "ambiguous redirect" error
What am I doing wrong?
|