find and replace string in a file

前端 未结 4 1958
天命终不由人
天命终不由人 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:12

    Use the -i option of sed to make the changes in place:

    sed -i "s/$OLD/$NEW/g" "$f"
        ^^
    

提交回复
热议问题