Using sed and grep/egrep to search and replace

前端 未结 6 833
小鲜肉
小鲜肉 2020-11-30 16:47

I am using egrep -R followed by a regular expression containing about 10 unions, so like: .jpg | .png | .gif etc. This works well, now I would like

6条回答
  •  囚心锁ツ
    2020-11-30 17:29

    My use case was I wanted to replace foo:/Drive_Letter with foo:/bar/baz/xyz In my case I was able to do it with the following code. I was in the same directory location where there were bulk of files.

    find . -name "*.library" -print0 | xargs -0 sed -i '' -e 's/foo:\/Drive_Letter:/foo:\/bar\/baz\/xyz/g'
    

    hope that helped.

    UPDATE s|foo:/Drive_letter:|foo:/ba/baz/xyz|g

提交回复
热议问题