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

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

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

    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