我有2个文件
文件一:
01:12:00,001 Some text
01:14:00,003 Some text
02:12:01,394 Some text
文件2:
01:12:00,001 Some text
01:12:01,029 Some text
01:13:21,123 Some text
我需要输出如下:
01:12:00,001 Some text
01:12:00,001 Some text
01:12:01,029 Some text
01:13:21,123 Some text
01:14:00,003 Some text
02:12:01,394 Some text
我怎样才能实现这个目标?
答案1
因为您要求文件按字段在文件中出现的顺序排序,所以这是最基本的用法sort
:
sort file1 file2 > outputfile
答案2
如果原始文件已经按时间戳顺序排列,则使用sort
.
sort -m file1 file2 > outputfile
从man sort
:
-m, --merge
merge already sorted files; do not sort