例如:

[2012-12-01 00:17:55]     alipay,billno:135,tradeNo:632063,TRADE_SUCCESS,total fee:10.00
[2012-12-01 00:17:55]     duomi diamonds num:110,id:8272
[2012-12-01 00:17:55]     pay success
[2012-12-01 00:17:55]     finish process,resltsuccess
[2012-12-01 01:44:16]     receive message...
[2012-12-01 01:44:16]     begin provess api:user.service_check
[2012-12-01 01:44:16]     service is ok
[2012-12-01 01:44:16]     finish process,resltsuccess
[2012-12-01 01:56:45]     receive message...
[2012-12-01 01:56:45]     begin provess api:user.alipay_callback
[2012-12-01 01:56:45]     alipay,billno:1354297456,tradeNo:994,tradeStatus,total fee:100.00
[2012-12-01 01:56:45]     add diamonds userid:101790681,num:1260,id:8273
需要打印出:
[2012-12-01 00:17:55]     alipay,billno:135,tradeNo:632063,TRADE_SUCCESS,total fee:10.00|duomi diamonds num:110,id:8272
[2012-12-01 01:56:45]     alipay,billno:1354297456,tradeNo:994,tradeStatus,total fee:100.00|add diamonds userid:101790681,num:1260,id:8273
方法一:

/bin/gawk  '{if($0 ~/alipay,billno/){a=$0;getline;$1=$2="";print a"|"$0}}'  log

方法二:
/bin/gawk  '{if($0 ~/alipay,billno/){a=$0;b=NR};if(NR==b+1) {$1=$2="";print a"|"$0}}'  log
/bin/gawk  '{if($0 ~/alipay,billno/){a=$0;b=NR};if(NR==b+1) {$1=$2="";sub(/^ */,"",$0);print a"|"$0}}' log

#sed处理下一行

mysql -uroot -h127.0.0.1    -e"show processlist\G" |sed  '/Time/{N;N;s/\n//g}'|awk -F'Time:|State' '{if($2>20){print $0}}'