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
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
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"