Hi, I have a file containing names of contigs eg.
contig_188 contig_222 contig_19
I also have another genbank file which looks like
// LOCUS A08_contig188 628 bp DNA linear UNK DEFINITION Contig A08_contig131 from balbla ACCESSION unknown FEATURES Location/Qualifiers source 1..628 /mol_type="genomic DNA" /db_xref="taxon: 6666666" /genome_md5="" /project="luke_6666666" /genome_id="6666666.23054" /organism="blabla" CDS complement(144..614) /db_xref="GO:0003723" /db_xref="GO:0005525" /db_xref="GO:0006605" /db_xref="GO:0006614" /db_xref="GO:0016020" /translation="MGDIVSLVEKAAQDLGEENLKKAEENLKKGQFSME +DYLSQLRQM KKMGGIEGIMSFMPGVSKIKSQMDSAGIDESIITKNEAIILSMTKKERE +NPKIIDGSR KKRIANGSGSDPATINKLLKQFKMMSEMMKKMSKGNLKGMSDKGIPPEL +FNQLK" /product="Signal recognition particle, subunit Ff +h SRP54 (TC 3.A.5.1.1)" BASE COUNT 168 a 132 c 76 g 252 t ORIGIN 1 tagtagaggg ttaaaaaaac caaccttctc tataaatctt ccgtcccttg caaaa +cgact 61 gtcggcaaca acaaccttat aaacaggacg tttttttgtt ccacctcttg ataat +cttaa 121 ttttaacatt tcttctcctt tttttacttt aattggttaa atagctctgg cggta +taccc 181 ttgtcagaca tacctttcag atttccttta gacatctttt tcatcatttc agaca +tcatt 241 ttaaattgct taagcaattt attgatagtg gctggatctg agccagagcc attag +caatt 301 cttttttttc tagaaccatc tattattttt gggttctctc tttctttttt tgtca +ttgat 361 aaaataatag cttcattttt agtaattata ctttcgtcaa ttcccgctga gtcca +tttga 421 gatttaattt tagaaactcc tggcataaaa gacataattc cctcaatgcc accca +ttttt 481 ttcatctgtc ttaattgaga caaataatct tccatagaga attgaccttt tttta +aattt 541 tcctctgctt ttttaagatt ttcttctcct aaatcttgag ccgccttttc tacaa +gggat 601 acaatatccc ccatacctag tattctgt // LOCUS A08_contig131 628 bp DNA linear UNK DEFINITION Contig A08_contig131 from blabla ACCESSION unknown FEATURES Location/Qualifiers source 1..628 /mol_type="genomic DNA" /db_xref="taxon: 6666666" /genome_md5="" /project="luke_6666666" /genome_id="6666666.23054" /organism="blabla" CDS complement(144..614) /db_xref="GO:0003723" /db_xref="GO:0005525" /db_xref="GO:0006605" /db_xref="GO:0006614" /db_xref="GO:0016020" /translation="MGDIVSLVEKAAQDLGEENLKKAEENLKKGQFSME +DYLSQLRQM KKMGGIEGIMSFMPGVSKIKSQMDSAGIDESIITKNEAIILSMTKKERE +NPKIIDGSR KKRIANGSGSDPATINKLLKQFKMMSEMMKKMSKGNLKGMSDKGIPPEL +FNQLK" /product="Signal recognition particle, subunit Ff +h SRP54 (TC 3.A.5.1.1)" BASE COUNT 168 a 132 c 76 g 252 t ORIGIN 1 tagtagaggg ttaaaaaaac caaccttctc tataaatctt ccgtcccttg caaaa +cgact 61 gtcggcaaca acaaccttat aaacaggacg tttttttgtt ccacctcttg ataat +cttaa 121 ttttaacatt tcttctcctt tttttacttt aattggttaa atagctctgg cggta +taccc 181 ttgtcagaca tacctttcag atttccttta gacatctttt tcatcatttc agaca +tcatt 241 ttaaattgct taagcaattt attgatagtg gctggatctg agccagagcc attag +caatt 301 cttttttttc tagaaccatc tattattttt gggttctctc tttctttttt tgtca +ttgat 361 aaaataatag cttcattttt agtaattata ctttcgtcaa ttcccgctga gtcca +tttga 421 gatttaattt tagaaactcc tggcataaaa gacataattc cctcaatgcc accca +ttttt 481 ttcatctgtc ttaattgaga caaataatct tccatagaga attgaccttt tttta +aattt 541 tcctctgctt ttttaagatt ttcttctcct aaatcttgag ccgccttttc tacaa +gggat 601 acaatatccc ccatacctag tattctgt //
I would like to grep only the genbank contig information which matches the first file (list of contig names) and write it into a new file.. Anyone can help?

In reply to How do i extract only contigs of interest by faozhi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.