text: user3364: I need the name of the protein in /product="protein_name" using bash commands. Beware, there is a lot of whitespace between lines.
  FEATURES             Location/Qualifiers
       source          1..1266
                       /organism="Sarcophilus harrisii"
                       /mol_type="mRNA"
                       /isolate="Salem"
                       /db_xref="taxon:9305"
                       /chromosome="1"
                       /map="unlocalized"
                       /sex="female"
                       /country="Australia: Taronga Zoo, Sydney"
       gene            1..1266
                       /gene="UROS"
                       /note="Derived by automated computational analysis using
                       gene prediction method: Gnomon. Supporting evidence
                       includes similarity to: 10 Proteins, and 100% coverage of
                       the annotated genomic feature by RNAseq alignments,
                       including 5 samples with support for all annotated
                       introns"
                       /db_xref="GeneID:100933602"
       CDS             60..908
                       /gene="UROS"
                       /codon_start=1
                       /product="uroporphyrinogen-III synthase isoform X1"
                       /protein_id="XP_003755055.2"
                       /db_xref="GeneID:100933602"
                       /translation="MRIPTSFSRGAWWKMKVLLLKDAKDDDSGLDPYLQELGSCGFEA
                       TLIPVLAFEFLSLPSFSEKLSHPEAYGGLVFTSPRAVEALQLSLERAGQLEVWKKSLK
                       EKWRLKPAYVVGQATASLVKKVGLAAEGEKCGNGEKLAEYICSRETPATLPLLFPCGT
                       LKGEVLPKTLKQKGILLESLTVYQKVQHPRMQDSLKSYFSTQGVPAGVTFFSPSGLTY
                       SLPHIQELSGASFDRIKFAAIGPTTARALASAGIPVSCTAEKPCPQDLAAGLQKALQP
                       SGPSSS"
  
  Right now I have this:
  while read p;
  do cat "${p}.gb" | tr "\"" " "| egrep -v "/db_xref= taxon"| egrep "/gene=|/db_xref=|/product=|/protein_id=" | sort | uniq | awk '{print($2)}END{print("")}'
  done <XM_codes.txt
  
  Which results in this:
  GeneID:100933602
  UROS
  uroporphyrinogen-111
  XP_003755055.2
  
  My output should be:
  GeneID:100933602
  UROS
  uroporphyrinogen-III synthase isoform X1
  XP_003755055.2
  
  
  user964: If you change the delimiter to something besides a space in the tr command (tr "\"" "\t") then you can use that same delimiter in the awk command (-F "\t").  In my example below I used a tab, also I filtered the taxon prior to the tr so that you don't have to worry about that staying in sync if you change the delimiter.
   egrep -v "/db_xref=\"taxon"| tr "\"" "\t" | egrep "/gene=|/db_xref=|/product=|/protein_id=" | sort | uniq | awk -F "\t" '{print($2)}END{print("")}';
  
  results:
  GeneID:100933602
  UROS
  uroporphyrinogen-III synthase isoform X1
  XP_003755055.2
  
  
original_text: 3364: <p>I need the name of the protein in /product="protein_name" using bash commands. Beware, there is a lot of whitespace between lines.</p>
  
  <pre><code>FEATURES             Location/Qualifiers
       source          1..1266
                       /organism="Sarcophilus harrisii"
                       /mol_type="mRNA"
                       /isolate="Salem"
                       /db_xref="taxon:9305"
                       /chromosome="1"
                       /map="unlocalized"
                       /sex="female"
                       /country="Australia: Taronga Zoo, Sydney"
       gene            1..1266
                       /gene="UROS"
                       /note="Derived by automated computational analysis using
                       gene prediction method: Gnomon. Supporting evidence
                       includes similarity to: 10 Proteins, and 100% coverage of
                       the annotated genomic feature by RNAseq alignments,
                       including 5 samples with support for all annotated
                       introns"
                       /db_xref="GeneID:100933602"
       CDS             60..908
                       /gene="UROS"
                       /codon_start=1
                       /product="uroporphyrinogen-III synthase isoform X1"
                       /protein_id="XP_003755055.2"
                       /db_xref="GeneID:100933602"
                       /translation="MRIPTSFSRGAWWKMKVLLLKDAKDDDSGLDPYLQELGSCGFEA
                       TLIPVLAFEFLSLPSFSEKLSHPEAYGGLVFTSPRAVEALQLSLERAGQLEVWKKSLK
                       EKWRLKPAYVVGQATASLVKKVGLAAEGEKCGNGEKLAEYICSRETPATLPLLFPCGT
                       LKGEVLPKTLKQKGILLESLTVYQKVQHPRMQDSLKSYFSTQGVPAGVTFFSPSGLTY
                       SLPHIQELSGASFDRIKFAAIGPTTARALASAGIPVSCTAEKPCPQDLAAGLQKALQP
                       SGPSSS"
  </code></pre>
  
  <p>Right now I have this:</p>
  
  <pre><code>while read p;
  do cat "${p}.gb" | tr "\"" " "| egrep -v "/db_xref= taxon"| egrep "/gene=|/db_xref=|/product=|/protein_id=" | sort | uniq | awk '{print($2)}END{print("")}'
  done &lt;XM_codes.txt
  </code></pre>
  
  <p>Which results in this:</p>
  
  <pre><code>GeneID:100933602
  UROS
  uroporphyrinogen-111
  XP_003755055.2
  </code></pre>
  
  <p>My output should be:</p>
  
  <pre><code>GeneID:100933602
  UROS
  uroporphyrinogen-III synthase isoform X1
  XP_003755055.2
  </code></pre>
   964: <p>If you change the delimiter to something besides a space in the <code>tr</code> command (<code>tr "\"" "\t"</code>) then you can use that same delimiter in the <code>awk</code> command (<code>-F "\t"</code>).  In my example below I used a tab, also I filtered the taxon prior to the <code>tr</code> so that you don't have to worry about that staying in sync if you change the delimiter.</p>
  
  <pre><code> egrep -v "/db_xref=\"taxon"| tr "\"" "\t" | egrep "/gene=|/db_xref=|/product=|/protein_id=" | sort | uniq | awk -F "\t" '{print($2)}END{print("")}';
  </code></pre>
  
  <p>results:</p>
  
  <pre><code>GeneID:100933602
  UROS
  uroporphyrinogen-III synthase isoform X1
  XP_003755055.2
  </code></pre>
  