[GRASS-user] Renaming many files with one command

Rich Shepard rshepard at appl-ecosys.com
Sat Mar 18 11:36:24 PDT 2017


On Sat, 18 Mar 2017, Vincent Bain wrote:

> Weird... sorry, I just notice you meant to rename rasters, not vectors.
> Anyway, here it works as well with rasters

>  GRASS 7.3.svn (local):~ > for i in `g.list type=raster
> pattern=open_h_*`;do g.rename rast=$i,`echo $i | sed
> s/open_h_/blocked_h_/g`;done

Vincent,

   This worked here, too. Looking very closely at the command I used before I
now see that I missed adding the substitute s to sed. That's why it didn't
work; sed didn't know what to do with the patterns.

   Mea culpa! And I had a second mug of coffee, too. No excuse here.

Thanks and best regards,

Rich






More information about the grass-user mailing list