ruby - ignoring header content of a text -


I'm getting rid of the contents of a file before "this word" and want to write that word after that term Am disk

  text = & lt; & Lt; EOT I only want the last line of the file after this word. This is the content that I want. Still this word can appear again EOT text.scan ("this word")   

Expected output:

  This is the content This word can appear again even if I want it.  

Like this?

  irb (main): 001: 0> Text = & lt; & Lt; EOT irb (main): 002: 0 "I only irb (main): 003: 0" after irb (main) the last lines of the file irb (main): 004: 0 ": 005: 0" Main) is: 006: 0 "Material I irb (main): 007: 0" want Irb (main): 008: 0 "EOT => I only want \ n the last lines of the file \ n after this word. It \ nmakes content I \ n \ N "irb (main): 009: 0> needle = 'this word.' = & Gt; " The word "irb (main): 012: 0> text [text.index (needle) + needle.length ..- 1] => I want the content \ n "irb (main): 013: 0> print text [text.index (needle) + needle.length ..- 1] This is the content that I want. = & Gt; Void    

Comments