sed 's/old/new/g' file.txt

Category: Text Processing

sed 's/old/new/g' file.txt

Replace all occurrences of 'old' with 'new'

Replaces every occurrence of 'old' with 'new' on each line. The /g flag means 'global' (all occurrences, not just the first).
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.