GRASS logo

NAME

g.rename.many - Renames multiple maps in the current mapset.

KEYWORDS

general, map management, rename

SYNOPSIS

g.rename.many
g.rename.many --help
g.rename.many [-sd] [raster=name] [raster_3d=name] [vector=name] [separator=character] [--help] [--verbose] [--quiet] [--ui]

Flags:

-s
Skip file format and map existence checks
By default a file format check is performed and existence of map is checked before the actual renaming. This requires going through each file two times. It might be advantageous to disable the checks for renames of large number of maps. However, when this flag is used an error occurs, some maps might be renamed while some others not.
-d
Do the checks only (dry run)
This will only perform the file format and map existence checks but it will not do the actual rename. This is useful when writing the file with renames.
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog

Parameters:

raster=name
File with rasters to be renamed
Format of the file is one raster map per line. Old name first, new name second (separated by comma by default)
raster_3d=name
File with 3D rasters to be renamed
Format of the file is one raster map per line. Old name first, new name second (separated by comma by default)
vector=name
File with vectors to be renamed
Format of the file is one vector map per line. Old name first, new name second (separated by comma by default)
separator=character
Field separator
Special characters: pipe, comma, space, tab, newline
Default: comma

Table of contents

DESCRIPTION

g.rename.many renames multiple maps at once using g.rename module. Old and new names are read from a text file. The file format is a simple CSV (comma separated values) format with no text delimiter (e.g. no quotes around cell content). Comma is a default cell delimiter but it can be changed to anything.

Possible use cases include:

EXAMPLE

Renaming rasters

First prepare a file with names of raster maps to be renamed. The file can be prepared in spreadsheet application (and saved as CSV with cell delimiter comma and no text delimiter) or as a text file in any (plain) text editor. In any case, the result should be a plain text file with format and content similar to the following sample:
landuse96_28m,landuse
geology_30m,geology
soilsID,soils
Once the file is prepared, the module can be called:
g.rename.many raster=raster_names.csv

This example worked only with raster maps. However multiple files, one for each map type, can be used at once.

Creating a file with current names

A template for renaming can be prepared using g.list module, for example in command line (bash syntax):
g.list type=raster mapset=. sep=",
" > raster_names.csv

Note that we are using only maps in a current Mapset because these are the only ones we can rename.

With some further processing file template can be made more complete by including map names twice (bash syntax):

g.list type=raster mapset=. | sed -e "s/\(.*\)/\1,\1/g" > raster_names.csv
The sed expression used here takes whatever is on a line on input and puts it twice on one line on the output separated by comma.

SEE ALSO

g.rename, g.list

AUTHOR

Vaclav Petras, NCSU OSGeoREL

Last changed: $Date: 2016-03-30 20:53:54 +0200 (Wed, 30 Mar 2016) $

SOURCE CODE

Available at: g.rename.many source code (history)


Main index | General index | Topics index | Keywords index | Graphical index | Full index

© 2003-2018 GRASS Development Team, GRASS GIS 7.4.1svn Reference Manual