[GRASSLIST:6059] g.copy

hello,

I would like to copy all of my raster maps starting with an "h" from my
current mapset to a new one in the same location.

I tried a little bit with g.copy e.g. g.copy rast= |grep h*@mapset_old,
h*@mapset_new but that doesn't work.

any suggestions for a bulk g.copy command?

thanks in advance, cheers Martin

--
Martin Wegmann
Department of Animal Ecology and Tropical Biology
Zoology III, Biocenter
Am Hubland
D-97074 Würzburg
Germany
E-Mail:
wegmann@biozentrum.uni-wuerzburg.de
m.wegmann@web.de

Like yourself, I wish GRASS had a lot more "bulk" commands to do this
automatically.
Instead, I use the shell's 'for' or 'foreach' command while in the
$LOCATION/cell directory like this (csh example):

Grass %> cd $LOCATION/cell
Grass %> foreach map (h*)
foreach? g.copy rast=$file@old,$file@new
foreach? end

-----Original Message-----
From: owner-GRASSLIST@baylor.edu [mailto:owner-GRASSLIST@baylor.edu]

On

Behalf Of Martin Wegmann
Sent: Tuesday, April 15, 2003 4:51 PM
To: GRASSLIST(engl)
Subject: [GRASSLIST:6059] g.copy

hello,

I would like to copy all of my raster maps starting with an "h" from

my

current mapset to a new one in the same location.

I tried a little bit with g.copy e.g. g.copy rast= |grep

h*@mapset_old,

h*@mapset_new but that doesn't work.

any suggestions for a bulk g.copy command?

thanks in advance, cheers Martin

--
Martin Wegmann
Department of Animal Ecology and Tropical Biology
Zoology III, Biocenter
Am Hubland
D-97074 Würzburg
Germany
E-Mail:
wegmann@biozentrum.uni-wuerzburg.de
m.wegmann@web.de

I would like to copy all of my raster maps starting with an "h" from my
current mapset to a new one in the same location.

I tried a little bit with g.copy e.g. g.copy rast= |grep h*@mapset_old,
h*@mapset_new but that doesn't work.

any suggestions for a bulk g.copy command?

try 'g.mlist h*' to get the raster names,
then a shell script using 'for' and g.copy,
and then 'g.mremove h*' to remove the maps from the old mapset.

Maybe a g.mcopy could be created from g.mremove?

good luck,
Hamish

thanks so far for your help, but I have still some problems left
I wrote a simple script:

#!/bin/bash
#copy all h*
g.mlist h*
read all
for raster in all ; do
g.copy rast=$raster,$raster@humbert ; done

well the first problem was that g.mlist works (->top) and suddenly stops
working, no output - I tried it as command directly in GRASS and it gives no
output either - the number of files starting with an h must be app. 3000 -
could that be the problem? I tried it with another specification which
selects ony a couple of maps and that gives an output. I don't need as visual
output, it shall only be able to read the selection, well and that's the
second problem...

the "read all" command doesn't work in this context. I tried g.mlist with
another specification (only 10 maps) and it is not reading these file names
either.

I am still thinking about the |grep command as possibility, but so far that
didn't work too.

g.copy .... is working when I tried it separately.

any idea? thanks Martin

--
Martin Wegmann
Department of Animal Ecology and Tropical Biology
Zoology III, Biocenter
Am Hubland
D-97074 Würzburg
Germany
E-Mail:
wegmann@biozentrum.uni-wuerzburg.de
m.wegmann@web.de