M
Michael Friendly
I'm wondering if there is a perl script or a simpler way to accomplish
the task of doing global search/replace in all files, possibly of
specified file types in a file tree, where *only* the files that match
the search string will be modified (because I need to preserve time
stamps so that only truly modified files will be rsync'd with a server).
Here's what I do now, using modified version of tcgrep (supporting a -E
flag to limit search to specified file extensions) to generate the list
of files to which the perl -pi~ command will apply:
% perl -pi~ -e
's|http://www.math.yorku.ca/SCS/Online|http://www.datavis.ca/online|g'
`tcgrep -lE html '/SCS/Online' .`
That is, I want to do the global search/replace, only among those files
whose names are returned by the tcgrep command.
I'm doing this a lot in moving stuff from one web server to another,
so it would be nice to simplify this someway.
-Michael
--
Michael Friendly Email: (e-mail address removed)
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA
the task of doing global search/replace in all files, possibly of
specified file types in a file tree, where *only* the files that match
the search string will be modified (because I need to preserve time
stamps so that only truly modified files will be rsync'd with a server).
Here's what I do now, using modified version of tcgrep (supporting a -E
flag to limit search to specified file extensions) to generate the list
of files to which the perl -pi~ command will apply:
% perl -pi~ -e
's|http://www.math.yorku.ca/SCS/Online|http://www.datavis.ca/online|g'
`tcgrep -lE html '/SCS/Online' .`
That is, I want to do the global search/replace, only among those files
whose names are returned by the tcgrep command.
I'm doing this a lot in moving stuff from one web server to another,
so it would be nice to simplify this someway.
-Michael
--
Michael Friendly Email: (e-mail address removed)
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA