Skip to content

Instantly share code, notes, and snippets.

@shellexy
Created October 28, 2011 15:25
Show Gist options
  • Save shellexy/1322533 to your computer and use it in GitHub Desktop.
Save shellexy/1322533 to your computer and use it in GitHub Desktop.
P 大说:要把一个文件里的全部 UUID 字符串全部 替换 成新的 UUID 字符串,每个 UUID 不能一样
#!/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