Linux command - sed and xargs

来源:互联网 发布:淘宝哪里有卖av碟片 编辑:程序博客网 时间:2024/06/10 15:28

Use sed to replace a string in a files:

# Replace string 'aaa' with 'bbb' in file.txtsed -i "s/aaa/bbb/g" file.txt# another examplesed -i "s:\(soaservices.dir=\).*:\1$WORKSPACE:" services.propertiessed -i "s:\(-Dtangosol.coherence.clusteraddress=\)[0-9]*.[0-9]*.[0-9]*.[0-9]*:\1${coherence_address}:" ${domain_home}/bin/setDomainEnv.sh

xargs - build and execute command lines from standard input

# Use grep as the inputgrep -l $old_server ${domain_home}/bin/* ${domain_home}/config/config.xml ${domain_home}/init-info/* | xargs sed -i "s/${old_server}/${new_server}/g"



原创粉丝点击