Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: One-line shell script for find and replace

by blazar (Canon)
on Oct 05, 2005 at 08:23 UTC ( [id://497522]=note: print w/replies, xml ) Need Help??


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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://497522]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-23 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found