awk if else

awk'{if($1=="aaa"){print"yes"}else{print"no"}}'aaa.txt

awk'BEGIN{FS="|"};{if(index($1,":")>0){printsubstr($1,1,index($1,":")-1)"|"$2"|"$3}else{print$1"|"$2"|"$3}}'tmp.1>tmp.4OK

相关推荐