Back

Linux 的几个好用的命令 ( sweet commands in linux)

发布时间: 2014-07-15 00:30:00

这是一个循环,把 /tmp/test.lst 文件中的 每一行都读出来,然后循环运行rsync 命令 . (注意其中的 exclude ) ( a loop that reads all the lines of contents in a file named /tmp/test.lst and then run them one by one)

for i in `cat /tmp/test.lst`;do
rsync -avzPl --exclude="2013*" --exclude="201404*" --exclude='*.log*' --exclude='*.git' --exclude='*.sql' ./$i 10.103.13.37::cmscode
done

在当前目录下,找到所有的文件中包含的 10.103.13.74 ,并且把它替换成: 10.103.13.37 ( find all the '10.103.13.74' and then replace them with '10.103.13.37') 这个功能跟 VIM plugin: Greplace 是一样的。

sed -i "s/10.103.13.74/10.103.13.37/g" `grep "10.103.13.74" -rl ./`

Back