find and replace string in a file

前端 未结 4 1959
天命终不由人
天命终不由人 2021-01-04 02:25

I\'m trying to find and replace a string in a folder of files.

Could someone possibly help me?

My script is as follows:

#!/bin/bash
OLD=\"Thi         


        
4条回答
  •  甜味超标
    2021-01-04 03:10

    this is a snippet i use, it removes all stuff between APA and BEPA (across multiple lines, including removing APA, BEPA) in all files below current directory, exclude the .svn directory

    find . \! -path '*.svn*' -type f -exec sed -i -n '1h;1!H;${;g;s/APA[ \t\r\n]*BEPA//g;p}' {} \;
    

提交回复
热议问题