文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>awk中next的用法

awk中next的用法

时间:2010-04-22  来源:aluoyeshi

next                 
Stop  processing  the current input record.  The next input record is read and processing starts over with the first pattern in the AWK program.  If the end  of  the input data is reached, the END block(s), if any, are executed.

举个例子:
cat file
1 a
2 b
3 c
4 d

awk '/^3/{print $2;next}{print $0}' file
1 a
2 b
c
4 d

如果匹配不到开头为3的记录,就打印$0
如果匹配到了开头为3的记录,就打印$2,这里如果没有next,会继续再打印$0

awk '/^3/{print $2}{print $0}'
1 a
2 b
c
3 c
4 d

next就是读取下一条记录,再从头执行代码
相关阅读 更多 +
排行榜 更多 +
卡通射击战场

卡通射击战场

飞行射击 下载
飞行汽车模拟器3d

飞行汽车模拟器3d

飞行射击 下载
弓箭手传奇魔法英雄免费版

弓箭手传奇魔法英雄免费版

休闲益智 下载