Ruplacer is a command line tool written in Rust programming language that allows users to perform search and replace operations across multiple files within a directory. This tutorial demonstrates how to install Ruplacer on Ubuntu 24.04.
Install Ruplacer
Download Ruplacer archive:
wget -qO ruplacer.tar.xz https://github.com/your-tools/ruplacer/releases/latest/download/ruplacer-x86_64-unknown-linux-gnu.tar.xz
Extract executable to /usr/local/bin
directory:
sudo tar xf ruplacer.tar.xz --strip-components=1 -C /usr/local/bin ruplacer-x86_64-unknown-linux-gnu/ruplacer
To verify the Ruplacer version, use the following command:
ruplacer --version
Remove the unneeded archive:
rm -rf ruplacer.tar.xz
Testing Ruplacer
Create simple file for testing:
echo "Hello world" > test.txt
Run this command to preview the changes without modifying the file:
ruplacer "world" "there" test.txt
Output:
test.txt:1 - Hello world
test.txt:1 + Hello there
Would perform 1 replacement on 1 matching file
Re-run ruplacer with --go to write these changes to the filesystem
If the preview looks correct, re-run the command with the --go
option to actually write the changes to disk:
ruplacer --go "world" "there" test.txt
Uninstall Ruplacer
To remove Ruplacer, delete the associated file:
sudo rm -rf /usr/local/bin/ruplacer
Leave a Comment
Cancel reply