4337 links
  • Arnaud's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
    Type 1 or more characters for results.
    Links per page: 20 50 100
    page 1 / 1
    15 results tagged sed x
    • Note: Replace literal \n with actual newline
      sed 's/\\n/\n/g' /tmp/t
      September 30, 2020 at 11:49:48 AM GMT+2 * - permalink - archive.org - https://links.infomee.fr/?cXcMlg
      backslash literal log logs n replace sed
    • Note: gnu sed on macos

      brew install gnu-sed
      PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"

      feel better

      January 29, 2019 at 12:47:22 PM GMT+1 - permalink - archive.org - https://links.infomee.fr/?HZ6B4w
      mac sed
    • thumbnail
      shell - bash / sh script to replace text between some tags/strings in a text file - Unix & Linux Stack Exchange

      Use

      sed '/#start/,/#end/replace_command'

      For example, if the file is called myconfig, and you want to replace "allow" with "deny" in that section, you could say

      sed '/#start/,/#end/s/allow/deny/' myconfig

      example

      sed -i -r "/<elasticConfig>/,/<\/elasticConfig>/s,<enabled>.+</enabled>,<enabled>false</enabled>," file.xml

      October 12, 2017 at 11:03:01 AM GMT+2 * - permalink - archive.org - https://unix.stackexchange.com/questions/272061/bash-sh-script-to-replace-text-between-some-tags-strings-in-a-text-file
      awk replace sed
    • Note: find/sed equivalent in python

      for root, dirs, files in os.walk("folder"):
      for file in files:
      if file.endswith(".yml"):
      print(os.path.join(root, file))
      with open(os.path.join(root, file), "r") as sources:
      lines = sources.readlines()
      with open(os.path.join(root, file), "w") as sources:
      for line in lines:
      sources.write(re.sub(r'pattern', 'foo', line))

      May 29, 2017 at 2:15:06 PM GMT+2 - permalink - archive.org - https://links.infomee.fr/?Y803hg
      find python sed
    • Note:

      DELIM=$(echo -en "\001");

      sed -i "s${DELIM}SEARCH${DELIM}${VAR}${DELIM}" $config

      February 14, 2017 at 3:45:21 PM GMT+1 - permalink - archive.org - https://links.infomee.fr/?3DXbeg
      delimiter sed
    • The UNIX School: Insert a line before or after a pattern

      ce qui est catch avec sed peut être utilisé dans le pattern de remplacement : &

      March 2, 2015 at 4:36:05 PM GMT+1 - permalink - archive.org - http://www.theunixschool.com/2012/06/insert-line-before-or-after-pattern.html
      sed
    • Sed supprimer une ligne

      je sais pas pourquoi j'arrive jamais à m'en souvenir :

      sed -i 8d file

      March 7, 2014 at 12:41:32 PM GMT+1 - permalink - archive.org - https://links.infomee.fr/?hAFpzw
      sed
    • The UNIX School: sed - 25 examples to delete a line or pattern in a file
      December 27, 2013 at 4:07:46 PM GMT+1 - permalink - archive.org - http://www.theunixschool.com/2012/06/sed-25-examples-to-delete-line-or.html
      sed
    • Sed tips

      Un petit truc pas mal pour sed sans risque, d'habitude je fais :
      sed -i 's/hello/toto/' file.txt
      Mais si le résultat ne me plait pas, trop tard le fichier est édité. On peut faire un backup en rajoutant un suffix à l'argument "-i" :
      sed -i.backup 's/hello/toto/' file.txt
      (oui oui tout attaché) Du coup je me retrouve avec deux fichiers : l'orgininal (file.txt.backup) et le modifié file.txt

      PS : on peut aussi faire autrement sans utiliser le -i et en redirigeant le résultat vers un nouveau fichier mais l'approche est différente

      December 5, 2013 at 2:53:35 PM GMT+1 - permalink - archive.org - https://links.infomee.fr/?rumjZQ
      sed tips
    • http://sed.sourceforge.net/sed1line.txt
      November 2, 2013 at 9:12:37 AM GMT+1 - permalink - archive.org - http://sed.sourceforge.net/sed1line.txt
      memo sed
    • Remplacer des mots dans plusieurs fichiers - Blog notes Aternatik

      grep -rl mot1 *.php | xargs sed -i 's/mot1/mot2/g'

      February 25, 2013 at 12:04:51 PM GMT+1 - permalink - archive.org - http://aternatik.org/articles-et-ressources/Remplacer-des-mots-dans-plusieurs
      grep sed
    • Cours utilisateur UNIX : Expressions régulières et sed

      bon cours

      February 15, 2013 at 10:00:40 AM GMT+1 - permalink - archive.org - http://www.funix.org/fr/unix/expr-sed.htm
      sed
    • Sed - An Introduction and Tutorial
      July 23, 2012 at 3:28:07 PM GMT+2 - permalink - archive.org - http://www.grymoire.com/Unix/Sed.html
      sed
    • thumbnail
      Rechercher et remplacer en ligne de commande bash shell en utilisant sed | Stratégies, solutions, design et développement Internet 2.0

      bash# sed -i ’s/[texte_recherché]/[texte_de_remplacement]/’ monfichier.txt

      Pour l’exercice nous allons dire que monfichier.txt comporte une liste d’anciennes adresses email @wanadoo.fr et que nous désirons les mettre à jour en @orange.fr .

      bash# cat monfichier.txt
      toto@wanadoo.fr
      toto@wanadoo.fr
      toto@wanadoo.fr
      etc.

      Donc dans ce cas, cela nous donnera :

      bash# sed -i ’s/wanadoo/orange/g’ monfichier.txt

      Voilà en détail l’explication :

      On passe à la commande sed le paramètre “-i” pour l’édition du fichier monfichier.txt
      Le paramètre “-s” (substituer) qui définit l’action de rechercher / remplacer,
      l’expression régulière (REGEX),
      puis le ‘g’ (action global) à la suite pour la modification de toutes les instances de la chaîne de caractères remplacer dans le fichier.
      Dans le cas où on voudrait ne remplacer que la première qui aurait été trouvée, il faudra modifier comme suit : ‘s/texte1/texte2/’

      Bon, cela fonctionne sur un fichier, maintenant dans le cas de plusieurs fichiers, voici la commande ‘find’ qui va compléter l’astuce.

      bash# find . -maxdepth 1 -name “*.txt” -type f -exec sed -i ’s/wanadoo/orange/g’ {} \

      En détail cela nous donne:

      Nous utilisons la commande ‘find’ pour récupérer la liste des fichiers ‘.txt’ à traiter,
      dans le dossier courant ‘.’ et de ne pas aller plus bas ‘-maxdepth 1′,
      puis donc de lister les fichiers dont le nom finit par “*.txt” :  ‘-name “*.txt” -type f’.
      on utilise alors l’option ‘-exec’ pour dire à ‘find’ d’utiliser la commande qui suit sur les fichiers trouvés.

      Et voilà, simple non ?

      July 23, 2012 at 3:24:06 PM GMT+2 - permalink - archive.org - http://supersonique.net/administration/rechercher-et-remplacer-en-ligne-de-commande-bash-shell-sed/
      bash linux rechercher remplacer sed
    • Welcome to The UNIX Grymoire!
      January 29, 2012 at 10:07:32 PM GMT+1 - permalink - archive.org - http://www.grymoire.com/Unix/
      find linux man reference sed unix
    Links per page: 20 50 100
    page 1 / 1
    Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation