Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find and replace crossing in muliple dirs. 1

Status
Not open for further replies.

timmy01

Programmer
Joined
May 8, 2007
Messages
2
Location
NL
Find and replace crossing in muliple dirs.

sh-3.00$ perl -pi -e 's/print"123/echo"abc/' *
Can't do inplace edit: dir1 is not a regular file.
Can't do inplace edit: dir1 is not a regular file, <> line 3352.

how can i find and replace the files located in dir1 and dir2?
 
maybe it's me.. but I have no clue what you are trying to do and the provide code doesn't clear it up for me either.
 
I got a feeling it's the use of "*" at the end. That might need to be replaced with something that returns a list of files instead of everything.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
@travs69 it does seem unclear to me at all! but anywayz...
again, what i try to do is change content of files located it
different directories....

@KevinADC maybe you dont know but * stand for all / wildcard
if i take this away than i have to specify all the files and that is exactly NOT what i want...

is it really so hard to understand!!!!!!!!!
 
timmy01

I think Kevin does know what a wildcard is. In fact, from my own observations of this forum, what he doesn't know about perl is hardly worth writing down.

The point he is trying to make to you, however is that your wild card includes everything - '.', '..', other directories etc. You need to put something in your code so that it only looks at files.

Is that
timmy01 said:
really so hard to understand!!!!!!!!!

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top