REPLACE(1)

πŸ“¦
version 13.0.2 Β· 6 versions
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu resolute, ubuntu stonking

✨ replace(1) β€” the string-swapper of your dreams ✨

okay bestie, welcome to replace, a lil utility from the MariaDB Database System fam πŸ’–. It's a string-replacement utility, and it's lowkey one of the most useful little gremlins in your toolbox. Let's get into it 🫢


🌸 NAME 🌸

replace β€” a string-replacement utility. That's it, that's the whole vibe. It changes strings, in place, and it ate πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

replace arguments

πŸ¦‹ DESCRIPTION πŸ¦‹

So the tea is: the replace utility program changes strings in place in files, or on the standard input. Periodt.

You can invoke replace in one of these two ways, and honestly pick your fighter:

shell> replace from to [from to] ... -- file_name [file_name] ...
shell> replace from to [from to] ... < file_name

from represents a string to look for, and to represents its replacement. And no, you're not limited to one β€” there can be one or more pairs of strings, go off πŸ‘‘

Use the -- option to indicate where the string-replacement list ends and the file names begin. In this case, any file named on the command line is modified in place, so like… you may want to make a copy of the original before converting it 😭 fr fr, back up your files. replace prints a message indicating which of the input files it actually modifies, so at least it tells you what it did πŸ‘€

If the -- option is not given, replace reads the standard input and writes to the standard output. No touching your files, just vibes ✨

replace uses a finite state machine to match longer strings first. Which means it can be used to swap strings 🌈 For example, the following command swaps a and b in the given files, file1 and file2:

shell> replace a b b a -- file1 file2 ...

The replace program is used by msql2mysql. See msql2mysql(1). iykyk πŸ’œ

replace supports the following options. Not a huge list, but every single one is iconic in its own way:

  • -?, -I β€” Display a help message and exit. Your lil emergency exit when you forget what you're doing πŸ™ˆ
  • -#debug_options β€” Enable debugging. For when you need to see the ~inner workings~ πŸ”₯
  • -s β€” Silent mode. Print less information about what the program does. Shhh 🀫
  • -v β€” Verbose mode. Print more information about what the program does. Not me wanting ALL the details πŸ’€
  • -V β€” Display version information and exit. Vibe check the version, then bounce ⭐

Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation

This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see http://www.gnu.org/licenses/.


πŸ’œ SEE ALSO πŸ’œ

For more information, please refer to the MariaDB Documentation, available online at https://mariadb.com/docs/ πŸ¦‹


🌈 AUTHOR 🌈

MariaDB Foundation (http://www.mariadb.org/). Absolute icons, no cap 🫢


and that's the whole page bestie!! go forth and replace responsibly, make backups, and remember: longer strings first, always πŸ’…βœ¨

MariaDB 11.8 β€” 5 March 2025 β€” REPLACE(1) πŸŽ€ that's the version and date, mwah, bye!! πŸ’–πŸŒΈ

πŸ“¦ where this page comes from