SHARE
TWEET

Untitled

a guest Jan 6th, 2012 584 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   #!/usr/bin/awk -f
  2.   BEGIN {
  3.     RS="" #将多行记录的分隔符定为一个空行
  4.   }
  5.   {
  6.     sum=0 #定义一个表示总和的变量,初值为0
  7.     for(i=1;i<=NF;i++){ #遍历所有字段
  8.       if((i%2)!=0){ #判断是否为奇数字段
  9.         sum += $i #如果是的话,累加这些字段的值
  10.       }
  11.     }
  12.     print sum,$2 #输出总和,后面跟上对应的网址
  13.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top