Remove particular lines from a text file in R
<p>I used <code>sink()</code> to write the output of my script to a .txt file but for whatever reason the prompt got written to the txt file too. I asked a question a few days ago to fix that but no answer so here I am approaching it from a different angle. Here is the txt file that got generated by my script:</p>

<pre><code>&gt; geno(hdr) 
DataFrame with 12 rows and 3 columns
            Number        Type                         Description
       &lt;character&gt; &lt;character&gt;                         &lt;character&gt;
GT               1      String                            Genotype
GQ               1     Integer                    Genotype Quality
DP               1     Integer                          Read Depth
HDP              2     Integer                Haplotype Read Depth
HQ               2     Integer                   Haplotype Quality
...            ...         ...                                 ...
mRNA             .      String                     Overlaping mRNA
rmsk             .      String                  Overlaping Repeats
segDup           .      String Overlaping segmentation duplication
rCov             1       Float                   relative Coverage
cPd              1      String                called Ploidy(level)

&gt; sink()
</code></pre>

<p>Since the lines I want gone are the ones that start with <code>&gt;</code>, I was thinking if there was a way to open the txt file and remove those particular lines. In this case, the lines <code>&gt; geno(hdr)</code> and <code>&gt; sink()</code> would be removed. I am not good at regex at all in R so I don't know how this would work. Any help appreciated. Thanks. </p>