Skip to content

pa-de-solminihac/resilient_replace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 

Repository files navigation

Resilient replace : search and replace, even in serialized text

With support for pipes, regexes, and efficiently using memory for large files

Examples

Replace domain.com with newdomain.com in a dump.sql file

resilient_replace -i 'domain.com' 'newdomain.com' dump.sql

Regular expressions support (PCRE regex)

Using --regex your can replace test0.domain.com or test11.domain.com without changing testing.domain.com

resilient_replace -i --regex 'test[0-9]*.domain\.com' 'newdomain.com' dump.sql

Pipes support

cat dump.sql | resilient_replace 'domain.com' 'newdomain.com'

Usage

resilient_replace <search_pattern> <replace> [<file>]

Options

    -i, --in-place
        edit file in place

    --regex
        treat <search_pattern> as a regex

    --only-into-serialized
        replace only into serialized data (do not replace into raw data)

Install

If you already have a ~/bin directory in your $PATH, you can just paste this in a terminal:

mkdir -p ~/bin && \
git clone https://github.com/pa-de-solminihac/resilient_replace.git ~/bin/resilient_replace_git && \
ln -s ~/bin/resilient_replace_git/resilient_replace ~/bin/resilient_replace

Upgrade

cd ~/bin/resilient_replace_git && git pull

About

Search and replace into serialized text

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages