global search and replace tool

T

Tandem person

I am in search of a free tool which can replace multiple strings on
the particular directory . Please let me know if any such , written in
perl.


Thanks
Athresh
 
J

Jürgen Exner

Tandem said:
I am in search of a free tool which can replace multiple strings on
the particular directory . Please let me know if any such , written in
perl.

I think you will have to explain a bit more what you are talking about.
Directories (at least in the typical standard operating systems) are mere
lists of files (in the broadest meaning) and
at least I can't see where strings and directories have anything to do with
each other.

jue
 
T

Tandem person

Hi specification is as below.

I have few function calls that has to be changed to the new one in the
whole source files ,present in a single directory. Please let me know
if any such tools available.
 
D

Donald 'Paddy' McCarthy

Tandem said:
Hi specification is as below.

I have few function calls that has to be changed to the new one in the
whole source files ,present in a single directory. Please let me know
if any such tools available.

perl -p -i -e 's/Oldname/Newname/' /pathToDir/*
 
J

Jürgen Exner

Tandem said:
I have few function calls that has to be changed to the new one in the
whole source files ,present in a single directory. Please let me know
if any such tools available.

In general you will need a fully-fledged parser for your particular
programming language in order to parse the source code of that programming
language. Otherwise you are running the risk that in addition to the desired
function calls other text pieces may be changed, too, if they happen to have
or contain the same character sequence (e.g. in a string or as part of the
name of some other function) .

If you think in your particular situation you can accept that risk then
please have a look at
- "perldoc -f glob" or "perldoc -f readdir" about how to get the names
of all files in a directory
- "perldoc perlop" for information about the "s" operator
("substitute"); maybe "perldoc perlre" for information about regular
expressions
- and "perldoc -q change" for the FAQ entry about "How do I change one
line in a file[...]?"

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,900
Latest member
Nell636132

Latest Threads

Top