Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我上一个问题的延续,使用 awk 或 bash 减去两列的值。我有 200 个文件。我想将每个文件的输出保存到一个文件夹中。这个文件夹中的文件名应该是父文件的名称。如何使用 Awk 或 Bash 做到这一点?
简单for的循环将完成这项工作:
for
for i in *; do mkdir "$i"_dir; awk -f your_awk_script.awk "$i" > "$i"_dir/out
说明:这里这个命令使用for,它遍历当前目录中的所有文件,然后它使用命令创建一个名称基于i-th 文件名的目录mkdir。
i
mkdir