Date: Sat, 7 Feb 2009 10:09:03 +0100 (CET) From: Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl> To: Adam Vande More <amvandemore@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: insert new line in files Message-ID: <20090207100621.X49625@wojtek.tensor.gdynia.pl> In-Reply-To: <498CBEBE.7080702@gmail.com> References: <498CBEBE.7080702@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090207100621.X49625>
