Replace a string in all files - Unix

后端 未结 2 1661
别那么骄傲
别那么骄傲 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 17:53

    A simple loop to process each file with sed should suffice.

    for inp in ./td/*; do
        fname=${inp##*/}
        sed 's/:::/::/g' "$inp" > ./od/"$fname"
    done
    

提交回复
热议问题