i'm trying search exact match set of patterns within file.
i've tried:
grep -w -f ids.txt seqs.txt > output.txt
but i'm missing of patterns.
example:
ids.txt denovo23 denovo28 denovo62 denovo897 denovo621 denovo622 seqs.txt denovo23 hns.2_9729 hns.2_20867 denovo28 hns.6_14948 hns.6_148211 hns.11_327521 denovo62 hns.7_468475 hns.7_631780 denovo897 wna.2_58410 wna.1_175071 denovo621 wna.2_20180 wna.2_294219 denovo622 ces.1_24310 hns.6_26786 denovo637 hns.2_262147 denovo586 hns.1_332240
expected output:
denovo23 hns.2_9729 hns.2_20867 denovo28 hns.6_14948 hns.6_148211 hns.11_327521 denovo62 hns.7_468475 hns.7_631780 denovo897 wna.2_58410 wna.1_175071 denovo621 wna.2_20180 wna.2_294219 denovo622 ces.1_24310 hns.6_26786
actual output:
denovo23 hns.2_9729 hns.2_20867 denovo28 hns.6_14948 hns.6_148211 hns.11_327521 denovo62 hns.7_468475 hns.7_631780 denovo897 wna.2_58410 wna.1_175071
so need way exact match of pattern within list in file. i've seen several ways exact match none work list in file - appreciated.
your grep -w -f
command works fine either on debian testing & bash 4.4 & gnu grep 2.27 or in freebsd11 vm bash 4.4 , bsd grep 2.5.1.
can not find wrong system causing grep fail.
in meantime can same job awk (tested in both debian gnu awk , freebsd non gnu awk):
awk 'nr==fnr{a[$1];next}$1 in a' ids.txt seq.txt
Comments
Post a Comment