在bash中排序和合并文件(脚本) [英] sort and join file in bash (script)

查看:130
本文介绍了在bash中排序和合并文件(脚本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使join命令输出的每个字段都用制表符分隔?

How do I get each field of the join command output to be separated by tabs?

推荐答案

这是替换流程的工作:

join <(sort annotation) <(sort output2.txt) >outputtest.txt

在这种用法中,<(sort annotation)将替换为类似文件的对象(/dev/fd/10 -form或命名管道),该对象在读取时包含命令sort annotation的输出.因此,join将看到已排序的输入,而无需就地修改两个文件(原始代码实际上并没有这样做).

In this usage, <(sort annotation) will be replaced with a file-like object (either /dev/fd/10-form or a named pipe) which, when read from, contains the output of the command sort annotation. Thus, join will see sorted input without needing to modify either file in-place (which the original code didn't actually do).

这篇关于在bash中排序和合并文件(脚本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆