perl replace text in multiple files

perl -pi -e 's~OLDTEXT~NEWTEXT~g' /path/to/filenames/*

Alternative (to avoid escaping slashes):

perl -pi -e 's|w/|with|g'
Last modified: December 5, 2012



Don’t for get to \ out any wildcards, spaces, etc inside the single quotes.

Write a Reply or Comment

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see

This site uses Akismet to reduce spam. Learn how your comment data is processed.