I want to insert a new line of text at a certain position in certain files recursively under a directory. More specifically, I want text like this:

include('/usr/home/www/imp-sites/default_inventory.php');

write a script:

#!/usr/local/bin/bash
(a=0
while [ $a -lt 36 ];do
 read line
 echo "$line"
 a=$[a+1]
done
echo "include('/usr/home/www/imp-sites/default_inventory.php');"
while read line;do
 echo "$line"
done) <$1 >/tmp/$$
mv -f /tmp/$$ $1


run it over each file

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to