Ir al contenido
  • +31 653-919-302
Cafayate.Net
  • 0
  • 0
  • Inicia sesión
  • Nederlands English (US) Español (AR)
  • Contáctanos
  • Inicio
  • Blog
  • Empleos
  • Contáctanos
Cafayate.Net
  • 0
  • 0
    • Inicio
    • Blog
    • Empleos
    • Contáctanos
  • +31 653-919-302
  • Nederlands English (US) Español (AR)
  • Inicia sesión
  • Contáctanos

SED rename

  • Todos los blogs
  • Tech Blog
  • SED rename
  • 5 de marzo de 2021 por
    Administrator

    A very simple solution: replace in all *.txt files in folder string_1 with string_2:

    sed -i 's/string_1/string_2/g' *.txt

     

    https://askubuntu.com/questions/84007/find-and-replace-text-within-multiple-files

     

    Here I use sed to replace every occurrence of the word “cybernetnews” with “cybernet” in every file with the extension, c, in the directory, /home/user/directory/.

    find /home/user/directory -name \*.c -exec sed -i "s/cybernetnews/cybernet/g" {} \;
    

    A more generic variation where you search recursively from the directory of execution and operate on only regular, readable, writeable files:

    find ./ -type f -readable -writable -exec sed -i "s/cybernetnews/cybernet/g" {} \;
    en Tech Blog
    Using LXD remote with ssh port forward

    Diseñado para empresas

    Somos un equipo de personas apasionadas cuyo objetivo es mejorar la vida de todos a través de productos revolucionarios. Creamos grandes productos para resolver sus problemas empresariales. Nuestros productos están diseñados para pequeñas y medianas empresas dispuestas a optimizar su rendimiento.

    Contáctenos

    Plantexel
    Pedernera
    Salta Capital 
    Argenina

    • +31 653-919-302
    • [email protected]
    Síganos
    Copyright © Plantexel
    Nederlands | English (US) | Español (AR)