gpt4 book ai didi

shell - grep "output of cat command - every line"在不同的文件中

转载 作者:行者123 更新时间:2023-12-01 07:11:02 28 4
gpt4 key购买 nike

抱歉,这个问题的标题有点令人困惑,但我想不出别的了。
我正在尝试做这样的事情

cat fileA.txt | grep `awk '{print $1}'` fileB.txt

fileA 包含 100 行,而 fileB 包含 1 亿行。

我想要的是从 fileA 中获取 id,在不同的 file-fileB 中 grep 该 id 并打印该行。
e.g fileA.txt
1234
1233

e.g.fileB.txt
1234|asdf|2012-12-12
5555|asdd|2012-11-12
1233|fvdf|2012-12-11

预期输出是
1234|asdf|2012-12-12
1233|fvdf|2012-12-11

最佳答案

摆脱catawk共:

grep -f fileA.txt fileB.txt

关于shell - grep "output of cat command - every line"在不同的文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14268404/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com