文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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就是读取下一条记录,再从头执行代码
相关阅读 更多 +
排行榜 更多 +
魔兽8m补丁 附使用方法

魔兽8m补丁 附使用方法

行业软件 下载
富甲天下5修改器 v1.0.5.0中文绿色版

富甲天下5修改器 v1.0.5.0中文绿色版

行业软件 下载
造梦西游5小望修改器 v2.2.1中文免费版

造梦西游5小望修改器 v2.2.1中文免费版

行业软件 下载