notebookCarnet de notes

  • A propos
  • Accueil
  • Anti-sèche
  • Notes
  • Syntaxe

    sed -i -e "s/chaines1/chaine2/g" fichier

    ou

    `sed 's/chaines1/chaines2/g;s/chaines3/chaines4/g'`
    

    Exemples avec échappements des caractères spéciaux

    sed -i -e "s/http\:\/\/selleriephoenix.com/http\:\/\/new.selleriephoenix.com/g" index.html

    find . -name "*.html" -type f -exec sed -i "s/http\:\/\/sellerie-phoenix.com/http\:\/\/new.selleriephoenix.com/g" {} \;

    find . -name "*.php" -type f -exec sed -i "s/\/shared\/www\/G-SoftS\/Phoenix\/new\//\/home\/www\/selphoenix\/www\//g" {} \;

    sed -i -e "s/<li class=\"menu\"><a href=\"http\:\/\/new.sellerie-phoenix.com\/produits\/briderie\">Briderie<\/a><\/li>/<li class=\"menu\"><a href=\"http\:\/\/new.sellerie-phoenix.com\/produits\/briderie\">Briderie<\/a><\/li><li class=\"menu\"><a href=\"http\:\/\/new.sellerie-phoenix.com\/produits\/boucles\">Boucles<\/a><\/li>/g" catalogue.html

    find . -name "*.html" -type f -exec sed -i "s/<li class=\"menu\"><a href=\"http\:\/\/new.sellerie-phoenix.com\/produits\/briderie\">Briderie<\/a><\/li>/<li class=\"menu\"><a href=\"http\:\/\/new.sellerie-phoenix.com\/produits\/briderie\">Briderie<\/a><\/li><li class=\"menu\"><a href=\"http\:\/\/new.sellerie-phoenix.com\/produits\/boucles\">Boucles<\/a><\/li>/g" {} \;


    Travail sur le footer

    *1

    <div id=\"footer\"><a rel=\"license\" href=\"http\:\/\/creativecommons.org\/licenses\/by-sa\/2.0\/fr\/\"><img alt=\"Licence Creative Commons\" style=\"border-width\:0\" src=\"https\:\/\/i.creativecommons.org\/l\/by-sa\/2.0\/fr\/88x31.png\"><\/a><br>Design sous license CC-BY-SA 2.0<\/div>

    *2

    find . -name "*.html" -type f -exec sed -i "s/<div id=\"footer\"> Creative Commons <a href=\"#\">Company Name<\/a> <\/div>/<div id=\"footer\"><a rel=\"license\" href\"http\:\/\/creativecommons.org\/licenses\/by-sa\/2.0\/fr\/\"><img alt=\"Licence Creative Commons\" style=\"border-width\:0\"src=\"https\:\/\/i.creativecommons.org\/l\/by-sa\/2.0\/fr\/88x31.png\"><\/a><br>Design sous license CC-BY-SA 2.0.<a href=\"http\:\/\/new.sellerie-phoenix.com\/confidentialité.html>Politique de confidentialité<\/a><\/div>/g" {} \;

    *3

    find . -name "*.php" -type f -exec sed -i "s/<div id=\"footer\"><a rel=\"license\" href=\"http\:\/\/creativecommons.org\/licenses\/by-sa\/2.0\/fr\/\"><img alt=\"Licence Creative Commons\" style=\"border-width\:0\" src=\"https\:\/\/i.creativecommons.org\/l\/by-sa\/2.0\/fr\/88x31.png\"><\/a><br>Design sous license CC-BY-SA 2.0.<a href=\"http\:\/\/new.sellerie-phoenix.com\/confidentialité.html>Politique de confidentialité<\/a><\/div>/<div id=\"footer\"><a rel=\"license\" href=\"http\:\/\/creativecommons.org\/licenses\/by-sa\/2.0\/fr\/\"><img alt=\"Licence Creative Commons\" style=\"border-width\:0\" src=\"https\:\/\/i.creativecommons.org\/l\/by-sa\/2.0\/fr\/88x31.png\"><\/a><br>Design sous license CC-BY-SA 2.0.<a href=\"http\:\/\/new.sellerie-phoenix.com\/confidentialité.html\">Politique de confidentialité<\/a><\/div>/g" {} \;