Is there another trick that you use to do global search and replace?
sed -i -e 's/original/replacement/' fileone.txt filetwo.txt ...
This is a good alternative too! Combined with grep it can do powerful things :)
If only there was some sensible way of replacing a multi-line search string.
Vim's regex can do this with a newline character. So having a buffer like:
one two three
This will hit the "one two"
:%s/one\ntwo/replaced/
In some cases, depending on the line endings, you might need to include the carriage return: \r
\r
I almost never get the search string right the first time, so using the highlight search and incremental search settings is really helpful.
:set hls incsearch
All this is super powerful, but I'll leave it to you to determine if it's sensible. :)
Oh yeah that's perfectly sensible and something I knew about, I was more talking about the sed approach
sed
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
sed -i -e 's/original/replacement/' fileone.txt filetwo.txt ...
This is a good alternative too! Combined with grep it can do powerful things :)
If only there was some sensible way of replacing a multi-line search string.
Vim's regex can do this with a newline character. So having a buffer like:
This will hit the "one two"
In some cases, depending on the line endings, you might need to include the carriage return:
\r
I almost never get the search string right the first time, so using the highlight search and incremental search settings is really helpful.
All this is super powerful, but I'll leave it to you to determine if it's sensible. :)
Oh yeah that's perfectly sensible and something I knew about, I was more talking about the
sed
approach