I’m betting there is a Unix command to do a batch search and replace of one string with another in all text files in a directory.
But I don’t know what it is.
I’m trying to follow Glynn’s advice to create a library of common TclTk procedures that can be called without calling another instance of gm.tcl (i.e., without launching another GIS Manager window).
These procedures (e.g., Gm::errmsg) get called a LOT in many modules. I’d like a way of replacing every occurance of “Gm::errmsg” with “GmLib::errmsg” in all modules in the TclTk GUI directory.
Can someone tell me if this is possible and, if so, how to do it?
Thanks
Michael
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>
Done and submitted:
http://trac.osgeo.org/grass/changeset/29624
I have used attached script.
Cheers
Markus
On Jan 9, 2008 7:02 AM, Michael Barton <michael.barton@asu.edu> wrote:
I'm betting there is a Unix command to do a batch search and replace of one
string with another in all text files in a directory.
But I don't know what it is.
I'm trying to follow Glynn's advice to create a library of common TclTk
procedures that can be called without calling another instance of gm.tcl
(i.e., without launching another GIS Manager window).
These procedures (e.g., Gm::errmsg) get called a LOT in many modules. I'd
like a way of replacing every occurance of "Gm::errmsg" with "GmLib::errmsg"
in all modules in the TclTk GUI directory.
Can someone tell me if this is possible and, if so, how to do it?
Thanks
Michael
(attachments)
change-string (412 Bytes)
With a fresh checkout from SVN (done about 3 hours ago),
I now get:
Error in startup script: can't create procedure "GmLib::errmsg": unknown
namespace
while executing
"proc GmLib::errmsg { error args } {
# send error report and optional message (args) to tk_messageBox
set message ""
if { $args !..."
(file "/usr/local/grass-6.3.svn/etc/gm/gm.tcl" line 543)
when trying to launch gis.m
Best,
Benjamin
Markus Neteler wrote:
Done and submitted:
http://trac.osgeo.org/grass/changeset/29624
I have used attached script.
Cheers
Markus
On Jan 9, 2008 7:02 AM, Michael Barton <michael.barton@asu.edu> wrote:
I'm betting there is a Unix command to do a batch search and replace of one
string with another in all text files in a directory.
But I don't know what it is.
I'm trying to follow Glynn's advice to create a library of common TclTk
procedures that can be called without calling another instance of gm.tcl
(i.e., without launching another GIS Manager window).
These procedures (e.g., Gm::errmsg) get called a LOT in many modules. I'd
like a way of replacing every occurance of "Gm::errmsg" with "GmLib::errmsg"
in all modules in the TclTk GUI directory.
Can someone tell me if this is possible and, if so, how to do it?
Thanks
Michael
------------------------------------------------------------------------
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
--
Benjamin Ducke, M.A.
Archäoinformatik
(Archaeoinformation Science)
Institut für Ur- und Frühgeschichte
(Inst. of Prehistoric and Historic Archaeology)
Christian-Albrechts-Universität zu Kiel
Johanna-Mestorf-Straße 2-6
D 24098 Kiel
Germany
Tel.: ++49 (0)431 880-3378 / -3379
Fax : ++49 (0)431 880-7300
www.uni-kiel.de/ufg
Sorry, fixed in SVN.
Markus
On Jan 9, 2008 2:51 PM, Benjamin Ducke <benjamin.ducke@ufg.uni-kiel.de> wrote:
With a fresh checkout from SVN (done about 3 hours ago),
I now get:
Error in startup script: can't create procedure "GmLib::errmsg": unknown
namespace
while executing
"proc GmLib::errmsg { error args } {
# send error report and optional message (args) to tk_messageBox
set message ""
if { $args !..."
(file "/usr/local/grass-6.3.svn/etc/gm/gm.tcl" line 543)
when trying to launch gis.m
Best,
Benjamin
Markus Neteler wrote:
> Done and submitted:
> http://trac.osgeo.org/grass/changeset/29624
>
> I have used attached script.
>
> Cheers
> Markus
>
>
> On Jan 9, 2008 7:02 AM, Michael Barton <michael.barton@asu.edu> wrote:
>> I'm betting there is a Unix command to do a batch search and replace of one
>> string with another in all text files in a directory.
>>
>> But I don't know what it is.
>>
>> I'm trying to follow Glynn's advice to create a library of common TclTk
>> procedures that can be called without calling another instance of gm.tcl
>> (i.e., without launching another GIS Manager window).
>>
>> These procedures (e.g., Gm::errmsg) get called a LOT in many modules. I'd
>> like a way of replacing every occurance of "Gm::errmsg" with "GmLib::errmsg"
>> in all modules in the TclTk GUI directory.
>>
>> Can someone tell me if this is possible and, if so, how to do it?
>>
>> Thanks
>> Michael
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-dev
--
Benjamin Ducke, M.A.
Archäoinformatik
(Archaeoinformation Science)
Institut für Ur- und Frühgeschichte
(Inst. of Prehistoric and Historic Archaeology)
Christian-Albrechts-Universität zu Kiel
Johanna-Mestorf-Straße 2-6
D 24098 Kiel
Germany
Tel.: ++49 (0)431 880-3378 / -3379
Fax : ++49 (0)431 880-7300
www.uni-kiel.de/ufg
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
--
Open Source Geospatial Foundation
http://www.osgeo.org/
http://www.grassbook.org/
Works fine again.
Cheers for the quick fixing.
Benjamin
Markus Neteler wrote:
Sorry, fixed in SVN.
Markus
On Jan 9, 2008 2:51 PM, Benjamin Ducke <benjamin.ducke@ufg.uni-kiel.de> wrote:
With a fresh checkout from SVN (done about 3 hours ago),
I now get:
Error in startup script: can't create procedure "GmLib::errmsg": unknown
namespace
while executing
"proc GmLib::errmsg { error args } {
# send error report and optional message (args) to tk_messageBox
set message ""
if { $args !..."
(file "/usr/local/grass-6.3.svn/etc/gm/gm.tcl" line 543)
when trying to launch gis.m
Best,
Benjamin
Markus Neteler wrote:
Done and submitted:
http://trac.osgeo.org/grass/changeset/29624
I have used attached script.
Cheers
Markus
On Jan 9, 2008 7:02 AM, Michael Barton <michael.barton@asu.edu> wrote:
I'm betting there is a Unix command to do a batch search and replace of one
string with another in all text files in a directory.
But I don't know what it is.
I'm trying to follow Glynn's advice to create a library of common TclTk
procedures that can be called without calling another instance of gm.tcl
(i.e., without launching another GIS Manager window).
These procedures (e.g., Gm::errmsg) get called a LOT in many modules. I'd
like a way of replacing every occurance of "Gm::errmsg" with "GmLib::errmsg"
in all modules in the TclTk GUI directory.
Can someone tell me if this is possible and, if so, how to do it?
Thanks
Michael
------------------------------------------------------------------------
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
--
Benjamin Ducke, M.A.
Archäoinformatik
(Archaeoinformation Science)
Institut für Ur- und Frühgeschichte
(Inst. of Prehistoric and Historic Archaeology)
Christian-Albrechts-Universität zu Kiel
Johanna-Mestorf-Straße 2-6
D 24098 Kiel
Germany
Tel.: ++49 (0)431 880-3378 / -3379
Fax : ++49 (0)431 880-7300
www.uni-kiel.de/ufg
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
--
Benjamin Ducke, M.A.
Archäoinformatik
(Archaeoinformation Science)
Institut für Ur- und Frühgeschichte
(Inst. of Prehistoric and Historic Archaeology)
Christian-Albrechts-Universität zu Kiel
Johanna-Mestorf-Straße 2-6
D 24098 Kiel
Germany
Tel.: ++49 (0)431 880-3378 / -3379
Fax : ++49 (0)431 880-7300
www.uni-kiel.de/ufg
Looks like you got some response already, but on the GUI side on OSX, BBEdit's find and replace can search whole folders of files. Their free TextWrangler also can. Full GREP support in both, and you can filter files.
On Jan 9, 2008, at 12:02 AM, Michael Barton wrote:
I'm betting there is a Unix command to do a batch search and replace of one string with another in all text files in a directory.
But I don't know what it is.
I'm trying to follow Glynn's advice to create a library of common TclTk procedures that can be called without calling another instance of gm.tcl (i.e., without launching another GIS Manager window).
These procedures (e.g., Gm::errmsg) get called a LOT in many modules. I'd like a way of replacing every occurance of "Gm::errmsg" with "GmLib::errmsg" in all modules in the TclTk GUI directory.
Can someone tell me if this is possible and, if so, how to do it?
Thanks
Michael
____________________
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/
All generalizations are dangerous, even this one.
Michael Barton wrote:
I'm betting there is a Unix command to do a batch search and replace
of one string with another in all text files in a directory.
But I don't know what it is.
GNU sed has the following extension:
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)
If you use that option, you can pass multiple filenames, and sed will
process each one separately, e.g.:
sed -i -e 's/old/new/g' *.txt
Without the -i script, the source files will be concatenated and
processed as a single stream.
If you don't have GNU sed, you need a loop, e.g.:
for file in *.txt ; do
sed 's/.../.../g' "$file" > "$file".tmp && mv -f "$file".tmp "$file"
done
--
Glynn Clements <glynn@gclements.plus.com>