转载:http://blog.csdn.net/ysdaniel/article/details/7905818整理自:http://bbs.chinaunix.net/thread-278896-2-1.html1. 概念上来说"[[",是关键字,许多shell(如ash bsh)并不支持这种方式。ksh, bash(据说从2.02起引入对[[的支持)等支持。"["是
转载:http://blog.chinaunix.net/uid-16480950-id-103953.html
要求:假如现在有个文本,格式如下:a 1b 2c 3b 4a 5d 6f 7g
3 5 6 72 3 1 04 5 6 92 3 4 42 2 1 04 5 0 9假如把2列和3列的值作为新的第5列,第5列的平均值为avg5,求第5列中大于avg5的行数。awk 'BEGIN{while(getline<"file"){x+=$2+$3;i++};y=x/i}{if($2+$3>y)z++}END{print z}' file[解析] 在BEGIN模块
Copyright © 2005-2025 51CTO.COM 版权所有 京ICP证060544号