起因的需求是 需求是 要找出a文件中id 对应在b文件中的信息,不难,循环a文件中的id,在b文件中进行grep,输出匹配上的上就还可以了
如下图两个文件
$ cat a.txt
id
abc
def
GHT
$ cat b.txt abc 12 hgy def 13 hl 123 14 hl2 GHT 11 hgy3
写个脚本
$ cat t3.sh
#!/bin/bash
cat a.txt | while read line ;
如下图两个文件
$ cat a.txt
id
abc
def
GHT
$ cat b.txt abc 12 hgy def 13 hl 123 14 hl2 GHT 11 hgy3
$ cat t3.sh
#!/bin/bash
cat a.txt | while read line ;