[GRASS-user] Renaming many files with one command
Rich Shepard
rshepard at appl-ecosys.com
Sat Mar 18 09:13:54 PDT 2017
On Sat, 18 Mar 2017, Vincent Bain wrote:
> my one-liner 2-cents solution :
>
> for i in `g.list type=vector pattern=open_h_*`;do g.rename vect=$i,`echo
> $i | sed s/open_h_/blocked_h_/g`;done
Vincent,
It's close, but not complete:
Renames data base element files in the user's current mapset.
Usage:
g.rename [raster=from,to] [raster_3d=from,to] [vector=from,to]
[label=from,to] [region=from,to] [group=from,to] [--overwrite]
[--help] [--verbose] [--quiet] [--ui]
Flags:
Parameters:
raster raster map(s) to be renamed
raster_3d 3D raster map(s) to be renamed
vector vector map(s) to be renamed
label paint label file(s) to be renamed
region region definition(s) to be renamed
group imagery group(s) to be renamed
ERROR: Sorry <open_h_max> is not a valid option
ERROR: Sorry <sed> is not a valid option
ERROR: Sorry </open_h_/blocked_h_/g> is not a valid option
ERROR: Option <raster> must be provided in multiples of 2
You provided 1 item(s): open_h_max,
There needs to be a second argument to g.rename raster=from,to and the $1
represents only the 'from' portion. There's no 'to' portion available from
g.list.
Looked good, though, and I thought it would work. I had not considered
this approach at all!
Thanks,
Rich
More information about the grass-user
mailing list