Thursday, January 06, 2005
FAQTs - Knowledge Base - View Entry - How can I use perl at the command line to do a Global Search & Replace within a directory? I want to remove ... but not ...: "Simple search-and-replace is easy with Perl. The one-liner I use is: perl -pi -e 's/search/replace/g' filename where /search/ becomes substituted by /replace/. To substitute the pattern in all files within a directory, simply replace the filename with a the wildcard *, like this:"
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment