Awk中调用shell命令
2015-09-01 19:44
706 查看
Awk中调用shell命令
需求 在awk中,有时候需要调用linux系统中命令,如计算字符串的MD5值,并保存下来。方法参考 call a shell command from inside awk and pass some awk variables to the shell command
cmd=sprintf("md5sum %s | cut -f2,2", url); #printf("command %s\n", cmd); cmd | getline sign_str; printf("%s\t%s\n", url, sign_str); close(cmd)
注意close不能省略,否则会影响后一次的计算。
相关文章推荐
- shell删除每行开始的数字
- shell 数组建立及使用技巧
- shell 将变量当命令执行问题【多条命令同时执行问题】
- Shell中的${}、##和%%使用范例
- Linux 下的shell
- /etc/profile /etc/profile .bash_profile .bashrc解释
- bash-completion linux tab自动补全增强
- Linux shell 交互式编程、TCL/TK 和 Expect 编译与安装、expect 编程
- 转帖-shell脚本$与if用法
- Hbase shell详情
- vim--find--bash---作业
- Linux:-bash: ***: command not found
- 【转载】HBase基本概念和hbase shell常用命令用法
- 已解决:登录Linux的 -bash-4.2$ 问题
- linux shell 编程 echo 语句 颜色
- 一个简单的shell脚本-----实现虚拟机实验环境的简单配置
- 一个简单的shell脚本-----实现虚拟机实验环境的简单配置
- 总结PowerShell的常用命令
- 数据输入/输出重定向
- linux C程序中获取shell脚本输出(如获取system命令输出)