find /root -name ‘*.sql' |xargs -i echo {} {} |sed ‘s/sql/txt/2′ |xargs mv
find /root/ -name ‘*.sql' |sed -e ‘s/\(.*\).sql$/mv \1.txt/e' //B哥提供
find /root/ -name ‘*.sql'|awk ‘{a=$0;sub(/sql$/,”txt”,$0); print “mv”, a,$0}'|bash
find /root/ -maxdepth 1 -name ‘*.sql'|awk ‘{a=$0;sub(/txt$/,”sql”,$0); system(“mv” ” “a” “$0)}'