Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: One-line shell script for find and replace

by PodMaster (Abbot)
on Oct 05, 2005 at 07:50 UTC ( [id://497510]=note: print w/replies, xml ) Need Help??


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

perl -pi -w -e 's/find/replace/g;' subdirectory/*.txt
??

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re^2: One-line shell script for find and replace
by blazar (Canon) on Oct 05, 2005 at 08:23 UTC
    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.
      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://497510]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-24 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found