The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-17-2008
surroscape surroscape is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 2
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?