text: user1377: I have a file with following information:
  chr1    HAVANA  gene    135141  135895  .       -       .       gene_id "ENSG00000268903.1"; gene_type "processed_pseudogene"; gene_name "AL627309.7"; level 2; havana_gene "OTTHUMG00000182518.2";
  chr1    HAVANA  gene    137682  137965  .       -       .       gene_id "ENSG00000269981.1"; gene_type "processed_pseudogene"; gene_name "AL627309.8"; level 2; havana_gene "OTTHUMG00000182738.2";
  chr1    HAVANA  gene    139790  140339  .       -       .       gene_id "ENSG00000239906.1"; gene_type "antisense_RNA"; gene_name "AL627309.2"; level 2; havana_gene "OTTHUMG00000002481.1";
  chr1    HAVANA  gene    141474  173862  .       -       .       gene_id "ENSG00000241860.6"; gene_type "processed_transcript"; gene_name "AL627309.5"; level 2; tag "ncRNA_host"; havana_gene "OTTHUMG00000002480.3";
  chr1    ENSEMBL gene    157784  157887  .       -       .       gene_id "ENSG00000222623.1"; gene_type "snRNA"; gene_name "RNU6-1100P"; level 3;
  chr1    HAVANA  gene    160446  161525  .       +       .       gene_id "ENSG00000241599.1"; gene_type "lincRNA"; gene_name "AL627309.4"; level 2; havana_gene "OTTHUMG00000002525.1";
  chr1    HAVANA  gene    182696  184174  .       +       .       gene_id "ENSG00000279928.2"; gene_type "unprocessed_pseudogene"; gene_name "FO538757.2"; level 2; havana_gene "OTTHUMG00000191962.1";
  chr1    HAVANA  gene    185217  195411  .       -       .       gene_id "ENSG00000279457.4"; gene_type "unprocessed_pseudogene"; gene_name "FO538757.1"; level 2; havana_gene "OTTHUMG00000191963.1";
  
  In the above file there is a gene_type with different names like processed_pseudogene, lincRNA, snRNA, unprocessed_pseudogene, antisense_RNA, processed_transcript.
  I want to create a new file based on gene_type. Among all the gene_types I want the new file to be with certain names of gene_type like only processed_pseudogene, lincRNA, unprocessed_pseudogene, antisense_RNA.
  The new file should look like below:
  chr1    HAVANA  gene    135141  135895  .       -       .       gene_id "ENSG00000268903.1"; gene_type "processed_pseudogene"; gene_name "AL627309.7"; level 2; havana_gene "OTTHUMG00000182518.2";
  chr1    HAVANA  gene    137682  137965  .       -       .       gene_id "ENSG00000269981.1"; gene_type "processed_pseudogene"; gene_name "AL627309.8"; level 2; havana_gene "OTTHUMG00000182738.2";
  chr1    HAVANA  gene    139790  140339  .       -       .       gene_id "ENSG00000239906.1"; gene_type "antisense_RNA"; gene_name "AL627309.2"; level 2; havana_gene "OTTHUMG00000002481.1";
  chr1    HAVANA  gene    160446  161525  .       +       .       gene_id "ENSG00000241599.1"; gene_type "lincRNA"; gene_name "AL627309.4"; level 2; havana_gene "OTTHUMG00000002525.1";
  chr1    HAVANA  gene    182696  184174  .       +       .       gene_id "ENSG00000279928.2"; gene_type "unprocessed_pseudogene"; gene_name "FO538757.2"; level 2; havana_gene "OTTHUMG00000191962.1";
  chr1    HAVANA  gene    185217  195411  .       -       .       gene_id "ENSG00000279457.4"; gene_type "unprocessed_pseudogene"; gene_name "FO538757.1"; level 2; havana_gene "OTTHUMG00000191963.1";
  
  
  user-1: grep -E 'gene_type "(processed_pseudogene|lincRNA|unprocessed_pseudogene|antisense_RNA)";' input_file.txt
  
  Explanation
  
  grep -E: use extended regular expression so you don't need to escape things.
  This kind of expression (foo|bar|baz) allows grep to include either of these strings. Hence, the total expression will match gene_type "processed_pseudogene";', gene_type "lincRNA";', etc.
  
  
original_text: 1377: <p>I have a file with following information:</p>
  
  <pre><code>chr1    HAVANA  gene    135141  135895  .       -       .       gene_id "ENSG00000268903.1"; gene_type "processed_pseudogene"; gene_name "AL627309.7"; level 2; havana_gene "OTTHUMG00000182518.2";
  chr1    HAVANA  gene    137682  137965  .       -       .       gene_id "ENSG00000269981.1"; gene_type "processed_pseudogene"; gene_name "AL627309.8"; level 2; havana_gene "OTTHUMG00000182738.2";
  chr1    HAVANA  gene    139790  140339  .       -       .       gene_id "ENSG00000239906.1"; gene_type "antisense_RNA"; gene_name "AL627309.2"; level 2; havana_gene "OTTHUMG00000002481.1";
  chr1    HAVANA  gene    141474  173862  .       -       .       gene_id "ENSG00000241860.6"; gene_type "processed_transcript"; gene_name "AL627309.5"; level 2; tag "ncRNA_host"; havana_gene "OTTHUMG00000002480.3";
  chr1    ENSEMBL gene    157784  157887  .       -       .       gene_id "ENSG00000222623.1"; gene_type "snRNA"; gene_name "RNU6-1100P"; level 3;
  chr1    HAVANA  gene    160446  161525  .       +       .       gene_id "ENSG00000241599.1"; gene_type "lincRNA"; gene_name "AL627309.4"; level 2; havana_gene "OTTHUMG00000002525.1";
  chr1    HAVANA  gene    182696  184174  .       +       .       gene_id "ENSG00000279928.2"; gene_type "unprocessed_pseudogene"; gene_name "FO538757.2"; level 2; havana_gene "OTTHUMG00000191962.1";
  chr1    HAVANA  gene    185217  195411  .       -       .       gene_id "ENSG00000279457.4"; gene_type "unprocessed_pseudogene"; gene_name "FO538757.1"; level 2; havana_gene "OTTHUMG00000191963.1";
  </code></pre>
  
  <p>In the above file there is a <code>gene_type</code> with different names like processed_pseudogene, lincRNA, snRNA, unprocessed_pseudogene, antisense_RNA, processed_transcript.</p>
  
  <p>I want to create a new file based on <code>gene_type</code>. Among all the gene_types I want the new file to be with certain names of <code>gene_type</code> like only processed_pseudogene, lincRNA, unprocessed_pseudogene, antisense_RNA.</p>
  
  <p>The new file should look like below:</p>
  
  <pre><code>chr1    HAVANA  gene    135141  135895  .       -       .       gene_id "ENSG00000268903.1"; gene_type "processed_pseudogene"; gene_name "AL627309.7"; level 2; havana_gene "OTTHUMG00000182518.2";
  chr1    HAVANA  gene    137682  137965  .       -       .       gene_id "ENSG00000269981.1"; gene_type "processed_pseudogene"; gene_name "AL627309.8"; level 2; havana_gene "OTTHUMG00000182738.2";
  chr1    HAVANA  gene    139790  140339  .       -       .       gene_id "ENSG00000239906.1"; gene_type "antisense_RNA"; gene_name "AL627309.2"; level 2; havana_gene "OTTHUMG00000002481.1";
  chr1    HAVANA  gene    160446  161525  .       +       .       gene_id "ENSG00000241599.1"; gene_type "lincRNA"; gene_name "AL627309.4"; level 2; havana_gene "OTTHUMG00000002525.1";
  chr1    HAVANA  gene    182696  184174  .       +       .       gene_id "ENSG00000279928.2"; gene_type "unprocessed_pseudogene"; gene_name "FO538757.2"; level 2; havana_gene "OTTHUMG00000191962.1";
  chr1    HAVANA  gene    185217  195411  .       -       .       gene_id "ENSG00000279457.4"; gene_type "unprocessed_pseudogene"; gene_name "FO538757.1"; level 2; havana_gene "OTTHUMG00000191963.1";
  </code></pre>
   -1: <pre><code>grep -E 'gene_type "(processed_pseudogene|lincRNA|unprocessed_pseudogene|antisense_RNA)";' input_file.txt
  </code></pre>
  
  <h1>Explanation</h1>
  
  <ul>
  <li><code>grep -E</code>: use extended regular expression so you don't need to escape things.</li>
  <li>This kind of expression <code>(foo|bar|baz)</code> allows grep to include either of these strings. Hence, the total expression will match <code>gene_type "processed_pseudogene";'</code>, <code>gene_type "lincRNA";'</code>, etc.</li>
  </ul>
  