小编lau*_*t01的帖子

join 和 cat 中的重定向

我想知道如何在此站点https://shapeshed.com/unix-join/ 的示例中使用重定向

这是输入

$ cat wine.txt
White Reisling Germany
Red Riocha Spain
Red Beaunes France

$ cat reviews.txt
Riocha Meh
Beaunes Great!
Reisling Terrible!
Run Code Online (Sandbox Code Playgroud)

这是命令和结果

$ join -1 2 -2 1 <(sort -k 2 wine.txt) <(sort reviews.txt)
Beaunes Red France Great!
Reisling White Germany Terrible!
Riocha Red Spain Meh
Run Code Online (Sandbox Code Playgroud)

但在这种情况下,双重使用 < 不起作用

$ cat file 1
Hello
$ cat file 2
World
Run Code Online (Sandbox Code Playgroud)

我预计

$ cat <file1 <file2    
Hello World
Run Code Online (Sandbox Code Playgroud)

但结果是

World
Run Code Online (Sandbox Code Playgroud)

你们有什么想法吗?

bash redirect process-substitution

1
推荐指数
1
解决办法
39
查看次数

标签 统计

bash ×1

process-substitution ×1

redirect ×1