in reply to Re: One-line shell script for find and replace
in thread One-line shell script for find and replace

perl -pi -w -e 's/find/replace/g;' subdirectory/*.txt [download]
??
To quote from the root node:
perl -pi -w -e 's/find/replace/g;' *.txt
How do I make the above one-liner to find and replace in sub-directories ?
which suggests he wants to traverse a directory tree recursively.

Replies are listed 'Best First'.
Re^3: One-line shell script for find and replace
by pkk (Scribe) on Oct 05, 2005 at 09:11 UTC
    Eg:
    1. home/xyz.txt
    2. home/contacts/abc.txt
    3. home/contacts/addresses/pqr.txt

    Within the 'home' directory I need to find and replace a particular word in all text files (xyz.txt, abc.txt, pqr.txt)
      1. How does this comment apply to the node you're replying to?
      2. How do the replies you already got fail to answer your question?
      Re the first point indeed I was explaining this to the person who had suggested subdirectory/*. So why do you write that to me rather than to him/her?