title: Data extraction and cleaning | Reading txt file and using grep
body: <p>I am reading multiple txt files using read.csv2 which saves them in a tibble format.</p>
  <p>I want to then extract row number with a certain string 'NASDAQ' and remove all rows above it and another string 'End' and remove all rows below it. Now when I use grep to do so, it always returns 1 as the value even though for, e.g., if my 'NASDAQ' row is row number 3. Also please note that there could be 2 'END' rows and I want to select the first one. An example is given below</p>
  <p>I will then combine the remaining rows in one continuous text and save in a data frame.</p>
  <pre><code>*# A tibble: 12 x 1*
     X1                                                       
     *&lt;chr&gt;*                                                    
   1 &quot;AMERICAN EXPRESS&quot;           
   2 &quot;Date: Aug 13 2020 12:01:33&quot;                             
   3 &quot;NASDAQ&quot;           
   4 &quot;Lorem ipsum dolor sit amet
   5 &quot;consectetur adipiscing elit, sed do eiusmod tempor incididunt&quot; 
   6 &quot;aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
   7 &quot;laboris nisi ut aliquip ex ea commodo consequat.&quot;     
   8 &quot;Aug/13/2020&quot;                                            
   9 &quot;End&quot;                              
  10 &quot;Copyright (c) 2020&quot;                                     
  11 &quot;END of story&quot;
  12 &quot;\f&quot;   
  </code></pre>