I use the replace utility (mysql/5.7.21/bin/replace) in our scripts as it has pretty simple syntax and much easier to use in comparison to "sed". However, with a mysql version upgrade, I have started getting the following:
Warning: replace is deprecated and will be removed in a future version.
Noticed that the utility is planned to be removed with MySQL 8.0.
Reference: https://dev.mysql.com/doc/refman/5.7/en/replace-utility.html
Do we know about any similar alternative that MySQL is going to introduce?
Answer by Bill Karwin is incorrect.
The replace
utility shipped with various MySQL distributions and the one from replace.richardlloyd.org.uk
are completely different programs, with different syntax and by different authors.
replace foo bar -- file.txt
. Multiple replacements can be specified by putting them before --
delimiter, e.g.: replace foo bar lorem ipsum -- file.txt
.-a
switch can be used, e.g. replace foo bar -a lorem ipsum file.txt
. Multiple -a
switches can be used.-e
switch.replace
utility shipped for MySQL:As put here, both programs have been packaged for CentOS / RHEL, e.g:
yum install https://extras.getpagespeed.com/release-latest.rpm
Then, for Richard K. Lloyd's replace
:
yum install replace2
Or, for the Oracle's replace
(its syntax rather):
yum install replace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With