You can check here about carriage charaters if they are there, by cat -v Input_file if they are present then you need to remove them. I tested the same command in my GNU grep and it worked fine for me, you can also check your grep version by grep --version too.
My first guess would be DOS <CR> line terminators. How were those files produced? If I add <CR> chars, the grep -f fails, without it works. RavinderSingh13's proposal will also fail with <CR>s present ( sub (/\r$/,"") could help in some awk s).
Remove them with e.g. tr -d '\r' <file1 or dos2unix file1 .
Dear all,
thanks again for your kindly help!
Attached you can find the files which i am using at the moment.
The lociid file (=file1) was generated with the following steps:
cut -f1 table > loci
sort loci > loci_sorted
uniq loci_sorted > lociids
For uploading the files i had to "rename" them:
mv lociids lociids.txt
mv table table.txt
Here is the output of the
head lociids.txt | od -bc
requested by Don Cragun
0000000 143 157 155 160 061 060 060 064 065 137 143 060 137 163 145 161
c o m p 1 0 0 4 5 _ c 0 _ s e q
0000020 061 012 143 157 155 160 061 060 060 071 061 137 143 060 137 163
1 \n c o m p 1 0 0 9 1 _ c 0 _ s
0000040 145 161 061 012 143 157 155 160 061 060 061 061 070 137 143 060
e q 1 \n c o m p 1 0 1 1 8 _ c 0
0000060 137 163 145 161 061 012 143 157 155 160 061 060 061 065 061 137
_ s e q 1 \n c o m p 1 0 1 5 1 _
0000100 143 060 137 163 145 161 061 012 143 157 155 160 061 060 061 065
c 0 _ s e q 1 \n c o m p 1 0 1 5
0000120 061 137 143 060 137 163 145 161 062 012 143 157 155 160 061 060
1 _ c 0 _ s e q 2 \n c o m p 1 0
0000140 061 065 071 137 143 060 137 163 145 161 061 012 143 157 155 160
1 5 9 _ c 0 _ s e q 1 \n c o m p
0000160 061 060 061 071 070 137 143 060 137 163 145 161 061 012 143 157
1 0 1 9 8 _ c 0 _ s e q 1 \n c o
0000200 155 160 061 060 062 060 064 137 143 060 137 163 145 161 061 012
m p 1 0 2 0 4 _ c 0 _ s e q 1 \n
0000220 143 157 155 160 061 060 062 060 064 137 143 060 137 163 145 161
c o m p 1 0 2 0 4 _ c 0 _ s e q
0000240 062 012 143 157 155 160 061 060 062 062 061 137 143 060 137 163
2 \n c o m p 1 0 2 2 1 _ c 0 _ s
0000260 145 161 062 012
e q 2 \n
0000264
You have 1955 duplicates in table.txt. Well possible that all are found in lociids.txt. Convince yourself - reduce lociids.tst to, say, 10 lines and try again...