Created
January 29, 2013 01:40
-
-
Save cuihaoleo/4660944 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 使用:replace.sh <替换列表> <被替换的文件> | |
# 忽略大小写,单词后加一个s会被当成复数视为同一单词,空格要用"\ "转义 | |
# 示范:https://gist.github.com/4660920 | |
cat $1 | while read src dest do sed -i -r "s/(\<${src}s?\>)/\1($dest)/ig" $2 done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment