文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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就是读取下一条记录,再从头执行代码
相关阅读 更多 +
排行榜 更多 +
跨维度自动售货机无限金币

跨维度自动售货机无限金币

模拟经营 下载
核日之后无限货币

核日之后无限货币

冒险解谜 下载
地牢狗无限金币钻石版

地牢狗无限金币钻石版

冒险解谜 下载