I have two files: one with list of names (500 entries) and other having some more information for each entry in A.txt and extra entries too.
File A.txt (each line is starting with >
(fasta format) and has spaces, digits and special characters too, but in single line)
>xyz, B=123
>abc, B=231
>mnp, B=567
File B.txt (has some particular information for each entry in A.txt in next line and has extra entries than file A)
>xyz, B=123
01010101010100101
>abc, B=231
1011110000011100000000
>mnp, B=567
10101
>opq, B=678
101010101010101001
>lmn, B=123
101010100000011
Result
>xyz, B=123
01010101010100101
>abc, B=231
1011110000011100000000
>mnp, B=567
10101
I want to grep the entries in list A.txt from list B.txt
thanks
grep -F -f A.txt -A 1 B.txt
.grep -A
. You can get rid of it by piping it togrep -v '^--$'
.