Skip to main content
added 106 characters in body
Source Link
Marcos
  • 2.4k
  • 3
  • 23
  • 33

Using sed, grep, awk, or ruby, what's a simple way to find the last match of a string in a larger log file, and send every line following it (inclusive) to another file?

Example:

grep -A222 "_____________" recent/toptrigs.OX.rb.log 

is my nearest workaround, since 222 lines of context afterword should always hit EOF first, except that I want it to start from the last instance of "_____________" string. It's a logfile simultaneously growing from the same process (so I manually flush STDOUT and STDERR at the end of each item's loop, with this segment cutting in mind).

Using sed, grep, awk, or ruby, what's a simple way to find the last match of a string in a larger log file, and send every line following it (inclusive) to another file?

Example:

grep -A222 "_____________" recent/toptrigs.OX.rb.log 

is my nearest workaround, since 222 lines of context afterword should always hit EOF first, except that I want it to start from the last instance of "_____________" string. It's a logfile simultaneously growing from the same process.

Using sed, grep, awk, or ruby, what's a simple way to find the last match of a string in a larger log file, and send every line following it (inclusive) to another file?

Example:

grep -A222 "_____________" recent/toptrigs.OX.rb.log 

is my nearest workaround, since 222 lines of context afterword should always hit EOF first, except that I want it to start from the last instance of "_____________" string. It's a logfile simultaneously growing from the same process (so I manually flush STDOUT and STDERR at the end of each item's loop, with this segment cutting in mind).

Source Link
Marcos
  • 2.4k
  • 3
  • 23
  • 33

extract last match from logfile till end

Using sed, grep, awk, or ruby, what's a simple way to find the last match of a string in a larger log file, and send every line following it (inclusive) to another file?

Example:

grep -A222 "_____________" recent/toptrigs.OX.rb.log 

is my nearest workaround, since 222 lines of context afterword should always hit EOF first, except that I want it to start from the last instance of "_____________" string. It's a logfile simultaneously growing from the same process.