Merci à tous, ca marche !!! David
On 11/8/06, Marcus Bauer <[EMAIL PROTECTED]> wrote:
On Wed, 2006-11-08 at 09:08 +0100, Jean-Max Reymond wrote: > 2006/11/8, David Pintor <[EMAIL PROTECTED]>: > > Par exemple, si je fais la commande suivante: > > > > $ sed 's/toto/titi/g' index.php > index.php > > > > il me vide carrement l'index.php. Si je fais la redirection vers un autre > > fichier (index2.php, par exemple) ça se passe bien. > > > > Si quelqu'un a une piste... > > un truc du genre: > > find rep -type f | xargs fgrep chaine | while read file;do > sed -e 's/XXXX/YYYY/g' < $f >$f.$$ > mv $f.$$ $f > done > Autre solution: find . -name 'index.php' | xargs sed -i "s/hello/world/g" De "man sed": -i[SUFFIX], --in-place[=SUFFIX] edit files in place (makes backup if extension supplied) Si tu as des fichiers avec des noms contenant des espaces: find . -name 'un fichier.php' -print0 | xargs --null sed -i "s/hello/world/g" Linux-Azur : http://www.linux-azur.org Désinscriptions: http://www.linux-azur.org/liste.php3 **** Pas de message au format HTML, SVP ****
Linux-Azur : http://www.linux-azur.org Désinscriptions: http://www.linux-azur.org/liste.php3 **** Pas de message au format HTML, SVP ****