Replace a string in all files - Unix

后端 未结 2 1685
别那么骄傲
别那么骄傲 2021-02-04 17:23

I am trying to replace a string ::: with :: for all lines in a batch of txtfiles (it can be considered as a word since there\'s always a space in front

2条回答
  •  無奈伤痛
    2021-02-04 18:14

    find . -name "./td/*.c" -exec sed -i "s/:::/::/g" '{}' \;
    

    No need for od/ at all.

    EDIT:

    A slightly simpler variation:

    ls td/*.c | xargs sed -i '' "s/:::/::/g"
    

提交回复
热议问题