Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Debian GNU/Linux Reference Guide
Prev Home Next

8.6.13 Regular-expression substitution

Replace all instances of FROM_REGEX with TO_TEXT in all of the files FILES ...:

     $ perl -i -p -e 's/FROM_REGEX/TO_TEXT/g;' FILES ...

-i is for "in-place editing", -p is for "implicit loop over FILES ...". If the substitution is complex, you can make recovery from errors easier by using the parameter -i.bak instead of -i; this will keep each original file, adding .bak as a file extension.

Debian GNU/Linux Reference Guide
Prev Home Next

  Published under the terms of the GNU General Public License Design by Interspire