4259 links
  • Arnaud's links
  • Home
  • RSS Feed
  • Tag cloud
  • Login
search: tag:replace — newest first
  • Note: terraform Interpolation-only expressions are deprecated

    :%s/("\${)//gc | %s/(}")//gc

    February 17, 2022 - permalink - https://links.infomee.fr/shaare/bnoJgw
    replace terraform
  • python - How to search and replace text in a file? - Stack Overflow

    Sometime you cant use sed :(

    Read in the file

    with open('file.txt', 'r') as file :
    filedata = file.read()

    Replace the target string

    filedata = filedata.replace('ram', 'abcd')

    Write the file out again

    with open('file.txt', 'w') as file:
    file.write(filedata)

    July 7, 2021 - permalink - https://stackoverflow.com/questions/17140886/how-to-search-and-replace-text-in-a-file
    nomarkdown python replace
  • Note: Replace literal \n with actual newline

    sed 's/\n/\n/g' /tmp/t

    September 30, 2020 - permalink - https://links.infomee.fr/shaare/cXcMlg
    backslash literal log logs n nomarkdown replace sed
  • 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>/s,.+,false," file.xml

    October 12, 2017 - permalink - https://unix.stackexchange.com/questions/272061/bash-sh-script-to-replace-text-between-some-tags-strings-in-a-text-file
    awk replace sed