A
Andrew Stewart
Hello,
What's a (good!) way to remove lines matching a pattern from a
multiline string?
For example, I would like to remove lines matching /usr/local/lib
from the multiline string:
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/
action_controller/test_process.rb:382:in `process'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/
action_controller/test_process.rb:353:in `post'
test/functional/orders_controller_test.rb:241:in
`test_should_handle_errors_on_edit'
...to give:
test/functional/orders_controller_test.rb:241:in
`test_should_handle_errors_on_edit'
I tried matching the pattern-to-remove with gsub and substituting an
empty string, but that leaves me with lots of blank lines and not
really any nearer to the answer.
Thanks and regards,
Andy Stewart
What's a (good!) way to remove lines matching a pattern from a
multiline string?
For example, I would like to remove lines matching /usr/local/lib
from the multiline string:
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/
action_controller/test_process.rb:382:in `process'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/
action_controller/test_process.rb:353:in `post'
test/functional/orders_controller_test.rb:241:in
`test_should_handle_errors_on_edit'
...to give:
test/functional/orders_controller_test.rb:241:in
`test_should_handle_errors_on_edit'
I tried matching the pattern-to-remove with gsub and substituting an
empty string, but that leaves me with lots of blank lines and not
really any nearer to the answer.
Thanks and regards,
Andy Stewart