如何调试AWK脚本 [英] How to debug an AWK script

查看:428
本文介绍了如何调试AWK脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

调试任何AWK脚本的提示是什么?

What are the tips for debugging any AWK script?

推荐答案

在代码中使用print语句可打印出变量值/返回值等.如果您使用的是 gawk ,则可以使用-W dump-variables[=file]选项将变量转储出去到文件进行调试.

Use the print statement in your code to print out values of variables/return values and so on. If you are using gawk, you can use the -W dump-variables[=file] option to dump variables out to a file for debugging.

此外,选项-W lint[=value]可能很有趣.有关更多信息,请参见文档.其他版本的AWK,例如pgawk提供了性能分析.

Also, the option -W lint[=value] might be of interest. See the documentation for more. Other versions of AWK, such as pgawk provides profiling.

一页 sed/awk的调试手册您的参考.

A page of the sed/awk book on debugging for your reference.

这篇关于如何调试AWK脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆