我有这样一个文件:
one vijay three
two vijay four
five chandu three
输出文件1
one vijay three
two vijay four
输出文件2
five chandu three
文件根据第二列的值拆分。
我可以在 shell 脚本中做到这一点。但我想它在 awk 中更简单。 我如何在 awk 中执行此操作?
最佳答案
awk '{print $0>$2".txt"}' file
关于bash - 根据列值将单个文件分成多个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5416461/