Search and replace text in all files of a linux directory

前端 未结 2 980
悲&欢浪女
悲&欢浪女 2021-02-01 03:36

I have a website directory where I need to change all hardcoded links from one domain to another. Looking for a single (grep? sed?) bash command that will allow me to change al

相关标签:
2条回答
  • 2021-02-01 04:11

    Also, try:

    perl -p -i -e <regex> <folder>
    
    0 讨论(0)
  • 2021-02-01 04:17

    The following will do it:

    sed -i 's/old_link/new_link/g' file...
    

    Don't forget to escape any slashes, dots, and any other regex special chars in the link addresses with a backslash.

    0 讨论(0)
提交回复
热议问题