Created
October 28, 2011 15:25
-
-
Save shellexy/1322533 to your computer and use it in GitHub Desktop.
P 大说:要把一个文件里的全部 UUID 字符串全部 替换 成新的 UUID 字符串,每个 UUID 不能一样
This file contains hidden or 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 | |
paveo(){ | |
REG="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" | |
CMD="" | |
for i in `sed -rn "/$REG/=" $1 ` | |
do | |
CMD="$CMD ; ${i}s/$REG/`uuid`/" | |
done | |
sed -r -i "$CMD" $1; | |
} | |
for F in "$@" | |
do | |
paveo "$F" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment