awk学习笔记(1)

学习文档: https://www.gnu.org/software/gawk/manual/gawk.html

 

 

 

-f, -E,-i,-l

-f source-file

--file source-file

Files named with -f are treated as if they had ‘@namespace "awk"’ at their beginning

-E file

--exec file

类似-f

  1. 这个结束选项的处理,如果还有其他部分,视为awk程序
  2. 不容许命令行参数(‘var=value’ are disallowed.)

选项更安全

-i source-file

--include source-file

从source-file中读取awk源库

这个选项完全等效使用@include指令

  1. 如果-i使用,程序源如果前面已经加载,就不再加载; -f总是加载
  2. 这个选项是跟代码库一起使用,gawk不会讲这个文件作为主程序的输入

Files named with -i are treated as if they had ‘@namespace "awk"’ at their beginning.

-l ext

--load ext

加载动态扩展 ext

扩展存为系统共享库

这选项使用AWKLIBPATH环境变量搜索库

 

 

@include 关键字可以用于读取外部awk源文件

@load 关键字可以用于读取外部awk扩展

posted @ 2021-02-19 22:38  郭复强  阅读(28)  评论(0)    收藏  举报