in reply to Re: Find and Replace text script?
in thread Find and Replace text script?

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: Find and Replace text script?
by gellyfish (Monsignor) on Jul 13, 2006 at 19:21 UTC

    Yeah sure, apart from the prompting bit that's what the above does. You just 'cd' to the appropriate 'folder' in the terminal and run the above.

    /J\

      find . -name '*.html' | xargs perl -pi -e 's/php\?/html/g'

      When I run this I get a bunch of "Can't open" lines even though I'm in the folder directory. Any ideas?

      Thanks,

      -Bob

        You have spaces in your file and/or directory names and I claim my five pounds. Try

        find . -name '*.html' -print0 | xargs -0 perl -pi -e 's/php\?/html/g'

        /J\

Re^3: Find and Replace text script?
by runrig (Abbot) on Jul 13, 2006 at 19:20 UTC
      > Have you tried google or Super Search yet?

      Yes, thanks. I found this:
      perl -p -i.bak -e 's/pattern1/pattern2/g' MysqlDump.sql

      http://www.wellho.net/forum/Perl-Programming/replace-text-in-a-large-text-file.html

      Thanks,

      -Bob