How do you replace multiple words in Linux?

Thanh Thảo

New member
How do you replace multiple words in Linux?
Answer
Linux Command Line: Find & Replace in Multiple Files
  1. grep -rl: search recursively, and only print the files that contain “old_string”
  2. xargs: take the output of the grep command and make it the input of the next command (ie, the sed command)
  3. sed -i ‘s/old_string/new_string/g’: search and replace, within each file, old_string by new_string.
2 июн. 2020 г.
 

Tìm kiếm

Back
Top