DEB Equivalent for RPM's 'replace' utilityGNOME alternatives / equivalent for Klipper?Looking for non-gui utility applicationIs there a checksum utility equivalent to Hashtab for Windows?Ubuntu equivalent for Mspaint.exe?What is the equivalent tool for autoit in ubuntu?SED command to replace certain string for the specific formatpartial line replace commandHow to replace text randomly from file?Text search and replaceFind & Replace in 80mb file?
Python program to find Armstrong numbers in a certain range
First Match - awk
The roles understanding in the agile development / Is the PO always right?
Using credit/debit card details vs swiping a card in a payment (credit card) terminal
Why does Mjolnir fall down in Age of Ultron but not in Endgame?
Why are GND pads often only connected by four traces?
Why didn't Thanos use the Time Stone to stop the Avengers' plan?
Parallel fifths in the orchestra
In general, would I need to season a meat when making a sauce?
Specific alignment within beginalign environment
My players want to grind XP but we're using milestone advancement
Why did Theresa May offer a vote on a second Brexit referendum?
Best material to absorb as much light as possible
What is a fully qualified name?
Can I tell a prospective employee that everyone in the team is leaving?
How to politely tell someone they did not hit "reply to all" in an email?
Is it true that cut time means "play twice as fast as written"?
How to respond to upset student?
Where have Brexit voters gone?
Make 24 using exactly three 3s
How to deal with a colleague who is being aggressive?
What is a Power on Reset IC?
Is it possible to remotely hack the GPS system and disable GPS service worldwide?
Is it legal to have an abortion in another state or abroad?
DEB Equivalent for RPM's 'replace' utility
GNOME alternatives / equivalent for Klipper?Looking for non-gui utility applicationIs there a checksum utility equivalent to Hashtab for Windows?Ubuntu equivalent for Mspaint.exe?What is the equivalent tool for autoit in ubuntu?SED command to replace certain string for the specific formatpartial line replace commandHow to replace text randomly from file?Text search and replaceFind & Replace in 80mb file?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I often use the very handy replace
command on my CentOS server:
The replace utility program changes strings in place in files or on the standard input.
It's not a standalone package even on the RPM side, I think it's part of a larger utility package. Anyway, I'm wondering if there's an Ubuntu equivalent of this? I know I can faff around with grep
and sed
, but replace
is much more convenient.
command-line software-recommendation text-processing
add a comment |
I often use the very handy replace
command on my CentOS server:
The replace utility program changes strings in place in files or on the standard input.
It's not a standalone package even on the RPM side, I think it's part of a larger utility package. Anyway, I'm wondering if there's an Ubuntu equivalent of this? I know I can faff around with grep
and sed
, but replace
is much more convenient.
command-line software-recommendation text-processing
1
Can you edit and provide an example how it’s used?
– dessert
10 hours ago
add a comment |
I often use the very handy replace
command on my CentOS server:
The replace utility program changes strings in place in files or on the standard input.
It's not a standalone package even on the RPM side, I think it's part of a larger utility package. Anyway, I'm wondering if there's an Ubuntu equivalent of this? I know I can faff around with grep
and sed
, but replace
is much more convenient.
command-line software-recommendation text-processing
I often use the very handy replace
command on my CentOS server:
The replace utility program changes strings in place in files or on the standard input.
It's not a standalone package even on the RPM side, I think it's part of a larger utility package. Anyway, I'm wondering if there's an Ubuntu equivalent of this? I know I can faff around with grep
and sed
, but replace
is much more convenient.
command-line software-recommendation text-processing
command-line software-recommendation text-processing
edited 9 hours ago
dessert
27.3k682115
27.3k682115
asked 10 hours ago
JimDeadlockJimDeadlock
309213
309213
1
Can you edit and provide an example how it’s used?
– dessert
10 hours ago
add a comment |
1
Can you edit and provide an example how it’s used?
– dessert
10 hours ago
1
1
Can you edit and provide an example how it’s used?
– dessert
10 hours ago
Can you edit and provide an example how it’s used?
– dessert
10 hours ago
add a comment |
2 Answers
2
active
oldest
votes
It can be extracted from downloading the mariadb-server-10.1
package. This does not install mariadb-server.
cd /tmp
apt download mariadb-server-10.1
dpkg-deb -R mariadb-server-10.1_1%3a10.1.38-0ubuntu0.18.04.2_amd64.deb .
sudo cp usr/bin/replace /usr/bin/
Then run replace
$ replace -?
replace Ver 1.4 for Linux at x86_64
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
This program replaces strings in files or from stdin to stdout.
It accepts a list of from-string/to-string pairs and replaces
each occurrence of a from-string with the corresponding to-string.
The first occurrence of a found string is matched. If there is
more than one possibility for the string to replace, longer
matches are preferred before shorter matches.
A from-string can contain these special characters:
^ Match start of line.
$ Match end of line.
b Match space-character, start of line or end of line.
For a end b the next replace starts locking at the end
space-character. A b alone in a string matches only a
space-character.
Usage: replace [-?svIV] from to from to ... -- [files]
or
Usage: replace [-?svIV] from to from to ... < fromfile > tofile
Options: -? or -I "Info" -s "silent" -v "verbose"
Yes that is indeed the one I'm looking for, thanks. I know it's on its last legs but I'm enjoying it while I can :)
– JimDeadlock
9 hours ago
@JimDeadlock Let me rewrite something here where you can extract it from a different application that doesn't scream deprecated. By the way, this answer only installs replace. You can delete the .deb file that gets downloaded when complete.
– Terrance
9 hours ago
add a comment |
The mariadb-server-10.1
, mysql-server-5.7
and percona-xtradb-cluster-server-5.7
packages contain versions of replace
, but these versions seem to be mostly old and some are even deprecated.
The software has a website called https://replace.richardlloyd.org.uk where you can download the latest version (2.24 currently) as a .tar.gz
file. Follow these steps to install replace
from this file:
Extract the
.tar.gz
archive:tar xf replace-*.tar.gz
Change into the directory:
cd replace-*/
The installation needs
gmake
, but it’s calledmake
in Ubuntu, so create a symlink:sudo ln -s /usr/bin/make /usr/bin/gmake
Run
gmake
:gmake
Change the shebang of
tests/runtests
tobash
(because it useslet
, whichsh
doesn’t have):sed '1s/sh/bash/' tests/runtests
Run the tests:
gmake test
Install the software to
/usr/local/bin/replace
:sudo gmake install
Once it’s installed you can remove the /usr/bin/gmake
symlink as well as the replace-N.NN/
directory and the .tar.gz
file:
cd .. && rm -r replace-*/ replace-*.tar.gz && sudo rm /usr/bin/gmake
Thanks, I think I'll get this one rather than insall the entire mysql-server package.
– JimDeadlock
9 hours ago
@JimDeadlock Added the installation steps for Ubuntu.
– dessert
8 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1145677%2fdeb-equivalent-for-rpms-replace-utility%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
It can be extracted from downloading the mariadb-server-10.1
package. This does not install mariadb-server.
cd /tmp
apt download mariadb-server-10.1
dpkg-deb -R mariadb-server-10.1_1%3a10.1.38-0ubuntu0.18.04.2_amd64.deb .
sudo cp usr/bin/replace /usr/bin/
Then run replace
$ replace -?
replace Ver 1.4 for Linux at x86_64
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
This program replaces strings in files or from stdin to stdout.
It accepts a list of from-string/to-string pairs and replaces
each occurrence of a from-string with the corresponding to-string.
The first occurrence of a found string is matched. If there is
more than one possibility for the string to replace, longer
matches are preferred before shorter matches.
A from-string can contain these special characters:
^ Match start of line.
$ Match end of line.
b Match space-character, start of line or end of line.
For a end b the next replace starts locking at the end
space-character. A b alone in a string matches only a
space-character.
Usage: replace [-?svIV] from to from to ... -- [files]
or
Usage: replace [-?svIV] from to from to ... < fromfile > tofile
Options: -? or -I "Info" -s "silent" -v "verbose"
Yes that is indeed the one I'm looking for, thanks. I know it's on its last legs but I'm enjoying it while I can :)
– JimDeadlock
9 hours ago
@JimDeadlock Let me rewrite something here where you can extract it from a different application that doesn't scream deprecated. By the way, this answer only installs replace. You can delete the .deb file that gets downloaded when complete.
– Terrance
9 hours ago
add a comment |
It can be extracted from downloading the mariadb-server-10.1
package. This does not install mariadb-server.
cd /tmp
apt download mariadb-server-10.1
dpkg-deb -R mariadb-server-10.1_1%3a10.1.38-0ubuntu0.18.04.2_amd64.deb .
sudo cp usr/bin/replace /usr/bin/
Then run replace
$ replace -?
replace Ver 1.4 for Linux at x86_64
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
This program replaces strings in files or from stdin to stdout.
It accepts a list of from-string/to-string pairs and replaces
each occurrence of a from-string with the corresponding to-string.
The first occurrence of a found string is matched. If there is
more than one possibility for the string to replace, longer
matches are preferred before shorter matches.
A from-string can contain these special characters:
^ Match start of line.
$ Match end of line.
b Match space-character, start of line or end of line.
For a end b the next replace starts locking at the end
space-character. A b alone in a string matches only a
space-character.
Usage: replace [-?svIV] from to from to ... -- [files]
or
Usage: replace [-?svIV] from to from to ... < fromfile > tofile
Options: -? or -I "Info" -s "silent" -v "verbose"
Yes that is indeed the one I'm looking for, thanks. I know it's on its last legs but I'm enjoying it while I can :)
– JimDeadlock
9 hours ago
@JimDeadlock Let me rewrite something here where you can extract it from a different application that doesn't scream deprecated. By the way, this answer only installs replace. You can delete the .deb file that gets downloaded when complete.
– Terrance
9 hours ago
add a comment |
It can be extracted from downloading the mariadb-server-10.1
package. This does not install mariadb-server.
cd /tmp
apt download mariadb-server-10.1
dpkg-deb -R mariadb-server-10.1_1%3a10.1.38-0ubuntu0.18.04.2_amd64.deb .
sudo cp usr/bin/replace /usr/bin/
Then run replace
$ replace -?
replace Ver 1.4 for Linux at x86_64
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
This program replaces strings in files or from stdin to stdout.
It accepts a list of from-string/to-string pairs and replaces
each occurrence of a from-string with the corresponding to-string.
The first occurrence of a found string is matched. If there is
more than one possibility for the string to replace, longer
matches are preferred before shorter matches.
A from-string can contain these special characters:
^ Match start of line.
$ Match end of line.
b Match space-character, start of line or end of line.
For a end b the next replace starts locking at the end
space-character. A b alone in a string matches only a
space-character.
Usage: replace [-?svIV] from to from to ... -- [files]
or
Usage: replace [-?svIV] from to from to ... < fromfile > tofile
Options: -? or -I "Info" -s "silent" -v "verbose"
It can be extracted from downloading the mariadb-server-10.1
package. This does not install mariadb-server.
cd /tmp
apt download mariadb-server-10.1
dpkg-deb -R mariadb-server-10.1_1%3a10.1.38-0ubuntu0.18.04.2_amd64.deb .
sudo cp usr/bin/replace /usr/bin/
Then run replace
$ replace -?
replace Ver 1.4 for Linux at x86_64
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
This program replaces strings in files or from stdin to stdout.
It accepts a list of from-string/to-string pairs and replaces
each occurrence of a from-string with the corresponding to-string.
The first occurrence of a found string is matched. If there is
more than one possibility for the string to replace, longer
matches are preferred before shorter matches.
A from-string can contain these special characters:
^ Match start of line.
$ Match end of line.
b Match space-character, start of line or end of line.
For a end b the next replace starts locking at the end
space-character. A b alone in a string matches only a
space-character.
Usage: replace [-?svIV] from to from to ... -- [files]
or
Usage: replace [-?svIV] from to from to ... < fromfile > tofile
Options: -? or -I "Info" -s "silent" -v "verbose"
edited 7 hours ago
dessert
27.3k682115
27.3k682115
answered 9 hours ago
TerranceTerrance
20.8k350101
20.8k350101
Yes that is indeed the one I'm looking for, thanks. I know it's on its last legs but I'm enjoying it while I can :)
– JimDeadlock
9 hours ago
@JimDeadlock Let me rewrite something here where you can extract it from a different application that doesn't scream deprecated. By the way, this answer only installs replace. You can delete the .deb file that gets downloaded when complete.
– Terrance
9 hours ago
add a comment |
Yes that is indeed the one I'm looking for, thanks. I know it's on its last legs but I'm enjoying it while I can :)
– JimDeadlock
9 hours ago
@JimDeadlock Let me rewrite something here where you can extract it from a different application that doesn't scream deprecated. By the way, this answer only installs replace. You can delete the .deb file that gets downloaded when complete.
– Terrance
9 hours ago
Yes that is indeed the one I'm looking for, thanks. I know it's on its last legs but I'm enjoying it while I can :)
– JimDeadlock
9 hours ago
Yes that is indeed the one I'm looking for, thanks. I know it's on its last legs but I'm enjoying it while I can :)
– JimDeadlock
9 hours ago
@JimDeadlock Let me rewrite something here where you can extract it from a different application that doesn't scream deprecated. By the way, this answer only installs replace. You can delete the .deb file that gets downloaded when complete.
– Terrance
9 hours ago
@JimDeadlock Let me rewrite something here where you can extract it from a different application that doesn't scream deprecated. By the way, this answer only installs replace. You can delete the .deb file that gets downloaded when complete.
– Terrance
9 hours ago
add a comment |
The mariadb-server-10.1
, mysql-server-5.7
and percona-xtradb-cluster-server-5.7
packages contain versions of replace
, but these versions seem to be mostly old and some are even deprecated.
The software has a website called https://replace.richardlloyd.org.uk where you can download the latest version (2.24 currently) as a .tar.gz
file. Follow these steps to install replace
from this file:
Extract the
.tar.gz
archive:tar xf replace-*.tar.gz
Change into the directory:
cd replace-*/
The installation needs
gmake
, but it’s calledmake
in Ubuntu, so create a symlink:sudo ln -s /usr/bin/make /usr/bin/gmake
Run
gmake
:gmake
Change the shebang of
tests/runtests
tobash
(because it useslet
, whichsh
doesn’t have):sed '1s/sh/bash/' tests/runtests
Run the tests:
gmake test
Install the software to
/usr/local/bin/replace
:sudo gmake install
Once it’s installed you can remove the /usr/bin/gmake
symlink as well as the replace-N.NN/
directory and the .tar.gz
file:
cd .. && rm -r replace-*/ replace-*.tar.gz && sudo rm /usr/bin/gmake
Thanks, I think I'll get this one rather than insall the entire mysql-server package.
– JimDeadlock
9 hours ago
@JimDeadlock Added the installation steps for Ubuntu.
– dessert
8 hours ago
add a comment |
The mariadb-server-10.1
, mysql-server-5.7
and percona-xtradb-cluster-server-5.7
packages contain versions of replace
, but these versions seem to be mostly old and some are even deprecated.
The software has a website called https://replace.richardlloyd.org.uk where you can download the latest version (2.24 currently) as a .tar.gz
file. Follow these steps to install replace
from this file:
Extract the
.tar.gz
archive:tar xf replace-*.tar.gz
Change into the directory:
cd replace-*/
The installation needs
gmake
, but it’s calledmake
in Ubuntu, so create a symlink:sudo ln -s /usr/bin/make /usr/bin/gmake
Run
gmake
:gmake
Change the shebang of
tests/runtests
tobash
(because it useslet
, whichsh
doesn’t have):sed '1s/sh/bash/' tests/runtests
Run the tests:
gmake test
Install the software to
/usr/local/bin/replace
:sudo gmake install
Once it’s installed you can remove the /usr/bin/gmake
symlink as well as the replace-N.NN/
directory and the .tar.gz
file:
cd .. && rm -r replace-*/ replace-*.tar.gz && sudo rm /usr/bin/gmake
Thanks, I think I'll get this one rather than insall the entire mysql-server package.
– JimDeadlock
9 hours ago
@JimDeadlock Added the installation steps for Ubuntu.
– dessert
8 hours ago
add a comment |
The mariadb-server-10.1
, mysql-server-5.7
and percona-xtradb-cluster-server-5.7
packages contain versions of replace
, but these versions seem to be mostly old and some are even deprecated.
The software has a website called https://replace.richardlloyd.org.uk where you can download the latest version (2.24 currently) as a .tar.gz
file. Follow these steps to install replace
from this file:
Extract the
.tar.gz
archive:tar xf replace-*.tar.gz
Change into the directory:
cd replace-*/
The installation needs
gmake
, but it’s calledmake
in Ubuntu, so create a symlink:sudo ln -s /usr/bin/make /usr/bin/gmake
Run
gmake
:gmake
Change the shebang of
tests/runtests
tobash
(because it useslet
, whichsh
doesn’t have):sed '1s/sh/bash/' tests/runtests
Run the tests:
gmake test
Install the software to
/usr/local/bin/replace
:sudo gmake install
Once it’s installed you can remove the /usr/bin/gmake
symlink as well as the replace-N.NN/
directory and the .tar.gz
file:
cd .. && rm -r replace-*/ replace-*.tar.gz && sudo rm /usr/bin/gmake
The mariadb-server-10.1
, mysql-server-5.7
and percona-xtradb-cluster-server-5.7
packages contain versions of replace
, but these versions seem to be mostly old and some are even deprecated.
The software has a website called https://replace.richardlloyd.org.uk where you can download the latest version (2.24 currently) as a .tar.gz
file. Follow these steps to install replace
from this file:
Extract the
.tar.gz
archive:tar xf replace-*.tar.gz
Change into the directory:
cd replace-*/
The installation needs
gmake
, but it’s calledmake
in Ubuntu, so create a symlink:sudo ln -s /usr/bin/make /usr/bin/gmake
Run
gmake
:gmake
Change the shebang of
tests/runtests
tobash
(because it useslet
, whichsh
doesn’t have):sed '1s/sh/bash/' tests/runtests
Run the tests:
gmake test
Install the software to
/usr/local/bin/replace
:sudo gmake install
Once it’s installed you can remove the /usr/bin/gmake
symlink as well as the replace-N.NN/
directory and the .tar.gz
file:
cd .. && rm -r replace-*/ replace-*.tar.gz && sudo rm /usr/bin/gmake
edited 7 hours ago
answered 9 hours ago
dessertdessert
27.3k682115
27.3k682115
Thanks, I think I'll get this one rather than insall the entire mysql-server package.
– JimDeadlock
9 hours ago
@JimDeadlock Added the installation steps for Ubuntu.
– dessert
8 hours ago
add a comment |
Thanks, I think I'll get this one rather than insall the entire mysql-server package.
– JimDeadlock
9 hours ago
@JimDeadlock Added the installation steps for Ubuntu.
– dessert
8 hours ago
Thanks, I think I'll get this one rather than insall the entire mysql-server package.
– JimDeadlock
9 hours ago
Thanks, I think I'll get this one rather than insall the entire mysql-server package.
– JimDeadlock
9 hours ago
@JimDeadlock Added the installation steps for Ubuntu.
– dessert
8 hours ago
@JimDeadlock Added the installation steps for Ubuntu.
– dessert
8 hours ago
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1145677%2fdeb-equivalent-for-rpms-replace-utility%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Can you edit and provide an example how it’s used?
– dessert
10 hours ago