Skip to content

Instantly share code, notes, and snippets.

@DiamondI
Created September 29, 2020 06:12
Show Gist options
  • Select an option

  • Save DiamondI/93daca9af00f0f3e8f9a9707723a90d0 to your computer and use it in GitHub Desktop.

Select an option

Save DiamondI/93daca9af00f0f3e8f9a9707723a90d0 to your computer and use it in GitHub Desktop.
[在awk中调用系统命令] #awk #terminal

在awk中调用系统命令

使用system即可。

例子

比如有一个文本文件htmlfile.txt,其中每一行都是html文件的文件名,如果想要将其中的文件都复制到目录utf8html下的话,可以像这样写:

awk '{print $1; system("cp " $1 " utf8html")}' ./htmlfile.txt

其中$1表示第一列的内容。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment