#awk执行多个if语句
cat /test/filename.log|awk ' {{if(/id/){su(/>[^<]*</,">BJ0<")}} \
{if(/name/){su(/>[^<]*</,">BJ1<")}} \
{if(/sex/){su(/>[^<]*</,">BJ2<")}} \
{if(/age/){su(/>[^<]*</,">BJ3<")}} \
{if(/address/){su(/>[^<]*</,">BJ4<")}} \
print}' >>/test/filename2.log #重定向到文本文件当中
#sed多个替换
cat /test/filename2.log|sed -e "s/ggg/999/g; \
s/qwe/999/g; \
s/iif/999/g; \
s/mnm/999/g; \
s/www/999/g" >>/test/filename3.log
cat /test/filename.log|awk ' {{if(/id/){su(/>[^<]*</,">BJ0<")}} \
{if(/name/){su(/>[^<]*</,">BJ1<")}} \
{if(/sex/){su(/>[^<]*</,">BJ2<")}} \
{if(/age/){su(/>[^<]*</,">BJ3<")}} \
{if(/address/){su(/>[^<]*</,">BJ4<")}} \
print}' >>/test/filename2.log #重定向到文本文件当中
#sed多个替换
cat /test/filename2.log|sed -e "s/ggg/999/g; \
s/qwe/999/g; \
s/iif/999/g; \
s/mnm/999/g; \
s/www/999/g" >>/test/filename3.log