1. Ready-made information on the Internet
Format: Sed-i "s/lookup field/replace field/g" ' grep lookup field-rl path '
Linux SED Bulk replaces strings in multiple files
Sed-i "s/oldstring/newstring/g" ' grep oldstring-rl yourdir '
For example: Replace the www.admin99.net in all files under/home to Admin99.net
Sed-i "s/www.admin99.net/admin99.net/g" ' grep www.admin99.net-rl/home '
Exp:sed-i "s/shabi/$/g" ' grep shabi-rl./'
2, self-added additional
2.1 Replace the text "garden" in file 1.txt with "Mirgarden"
# sed-i "s/garden/mirgarden/g" 1.txt//sed-i very simple
2.2 Replace "garden" in all files in the current directory with "Mirgarden"
# # Sed-i "s/garden/mirgarden/g" ' ls '//is actually the LS out of multiple filenames
Replace the space in the middle of the text in VI (the middle of the text contains ^m)
Command:% s/\r//g
Bulk Replace file contents under Linux