linux - awk 使用外部脚本和 <

标签 linux bash ubuntu

我该怎么做:

awk < file '{ print $2 }'

“{ print $2 }”在名为 awk-script 的文件中的哪个位置?

我最好的猜测是

awk < file `command awk-script`

awk < file `cat awk-script`

但没有成功。

最佳答案

你需要做的

awk -f awk-script < file

awk-script 包含

[tthangavel@ltest ~/test]$ cat awk-script
{ print $2}

关于linux - awk 使用外部脚本和 <,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32941906/

相关文章:

arrays - 一个文本文件中的两个数组

linux - Wayland 上的 libinput-gestures : can't get 'super' key

混帐上传包 : command not found

Ubuntu nginx 容器 403 被禁止

linux - 带有最后一个退出代码的 Bash 提示

linux - Bash 脚本 : Alphabetize strings without using -sort

更改 my.cf 后 MySQL 将无法启动

c++ - 为什么在我的 Apache 2.2 模块中调用 ap_hook_type_checker 函数时 request_rec::filename NULL?

bash - 根据变量状态重定向命令的输出

linux - ls 列出指定目录中的匹配项