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

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\

Replies are listed 'Best First'.
Re^4: Find and Replace text script?
by bobafifi (Beadle) on Jul 13, 2006 at 19:58 UTC
    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\

        > You have spaces in your file and/or directory names

        Nope, no spaces in either. I just tried your code, it didn't crash or anything, just gave me a new line - files remain unchanged. Have you tried this on a test folder and got it to work? If so, can you please run down the steps? I'm obviously doing something wrong ...

        Thanks,

        -Bob