Skip to content

Samer-Al-iraqi/Linux-str_replace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Linux-str_replace

Notes

I dont' support this anymore. the file is loaded fully in memory before processing!

This perl script will enable you to do literal search and replace in files (in place) and in STDIN

No messing with regular expression anymore. No more sed or awk or perl -pie. This handy script written in perl will replace text exactly as you want, No matter it has the so-called special characters or not. Just like str_replace PHP function.

Usage

str_replace Search Replace File # replace in File in place 

OR

STDIN | str_replace Search Replace # to STDOUT

install

Execute this line in your linux server

wget https://raw.githubusercontent.com/Samer-Al-iraqi/Linux-str_replace/master/str_replace.pl \
-O /usr/local/str_replace && \
chmod a+x /usr/local/bin/str_replace

Notes:

  • Search and replace always case-sensitive
  • Always do global Search and replace
  • Don't care about lines.
  • It may work in Windows as well.
  • tested with unicode (I suprised it worked correctly!)

Hope it will help. Thanks

About

Non-Regex text search and replace for linux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages