How to skip a directory in awk?

后端 未结 2 1777
攒了一身酷
攒了一身酷 2021-01-12 19:33

Say I have the following structure of files and directories:

$ tree
.
├── a
├── b
└── dir
    └── c

1 directory, 3 files

That is, two file

2条回答
  •  野的像风
    2021-01-12 19:50

    I would simply avoid to pass directories to awk since even POSIX says that all filename args must be text files.

    You can use find for traversing the directory:

    find PATH -type f -exec awk 'program' {} +
    

提交回复
热议问题