[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux] Re: script bash



Merci Pascal,

Je vais qd même lire le Howto (j'aurais du commencer par là)
et j'essaye ce petit script

  Didier 




> Je voudrais un petit script pour faire le change automatiquement dans 
TOUS 
> les membres *html d'un directory.

#!/bin/bash
find . -name '*.html' | while read f; do
    [ ! -f "${f}.old" ] && mv "$f" "${f}.old"
    sed 's!\\mrtg\\!/mrtg/!g' < "${f}.old" > "$f"
done

Ca te fait un backup des fichiers originaux comme .old
Si un fichier .old existe déjà, il ne sera *pas* écrasé.

-- 
   -o) Pascal Bleser   ATOS Origin/Aachen(DE) |
   /\\         <pascal.bleser@atosorigin.com> |
  _\_v <guru@linuxbe.org>                     |
---------------------------------------------|
Jesus saves,Buddha makes incremental backups :
---------------------------------------------'


_______________________________________________
Linux Mailing List
LCP - 11 Mai - http://www.unixtech.be/lcp.php
Archives: http://www.unixtech.be/mailman/listinfo/linux