A very simple command to replace text:
1 sed -i 's/www.a.cn/www.b.com/g' common.sh
Command C expectations following by text
may also report invalid command code W
But the same command can be executed correctly on the server. See the explanation in the – I option of man sed under Mac
-i extension
Edit files in-place, saving backups with the specified extension. If a zero-length extension is given, no backup will be
saved. It is not recommended to give a zero-length extension when in-place editing files, as you risk corruption or par-
tial content in situations where disk space is exhausted, etc.
The general meaning is that Mac will force backup when using – I option, so you must give a suffix to backup. If you don’t want to backup, you can use empty character directly
1 sed -i 's/www.a.cn/www.b.com/g' common.sh
Similar Posts:
- [Solved] SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘vod_content’.
- [Solved] Operating system error 995(The I/O operation has been aborted because of either a thread)
- used in key specification without a key length
- Visit the back-end application through nginx and report an error err_ CONTENT_ LENGTH_ MISMATCH
- [Solved] MYSQL ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot e…
- [Solved] Psql reports “invalid command \N” error when restoring data
- Leet code 44 wildcard matching – wildcard matching – Java
- [Solved] SpringBoot Error: Caused by: org.yaml.snakeyaml.error.YAMLException: java.nio.charset.Malforme
- [linux] mv: cannot move $ to $: Directory not empty