开发者

Moving back and forth between dierctorys in AWK

开发者 https://www.devze.com 2023-03-25 02:06 出处:网络
In AWK,开发者_运维知识库 how can I move back and forth between directories using “cd” command?

In AWK,开发者_运维知识库 how can I move back and forth between directories using “cd” command?

To illustarte what I am looking for, here is a small senario:

If a root directory includes subdirectory called subD. Now, assume that I have the awk srcipt code '*.awk' in the root directory, and I would the awk program to move to the subdirectory "subD", run a program, and return back to root directory.


Use the absolute path to the files that you're reading so you don't need to change the current working directory inside your code.


Usually it is better to put only text processing logic to awk code, and things like directory traversal in shell script calling that awk code.


Use system(cmd) to run the external command cmd.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号