One Line PERL Find / Replace

Uncategorized Add comments

perl -pi -e ‘s/find/replace/g’ file.name(s)

4 Responses to “One Line PERL Find / Replace”

  1. Parmi Says:

    How about using sed to instead:

    sed ‘s:find:replace:g’ -i file.name(s)

    ‘-i’ tells sed to make the edits ‘in-place’.

  2. klkl Says:

    Thank you for the information.

    I’ve used sed before and it does look a more clean command to use.

    At the time I needed to use it the knowledge of sed eluded me.

  3. klkl Says:

    It appears the version of sed installed on macs is lame. I think I’ll stick with the PERL at least that works first time every time.

  4. maria perez Says:

    Great tool!

Leave a Reply

WP Theme & Icons by N.Design Studio | Akismet has gobbled 335,630 spam comments...Mmmm Tasty :-)
Entries RSS Comments RSS Log in