[GRASS-user] Renaming many files with one command

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


On Sat, 18 Mar 2017, Vincent Bain wrote:

> Rich, this should work indeed (I just tested it down here, it works)... at
> least if you have sed installed on your system. And also carefully mind
> the reverse quotes(``) that enclose subprocesses.

Vincent,

   Yes, sed is part of all linux distributions and I've used it many times in
the past. However, it did not work here and I do use backticks to evaluate
the string between them prior to handing the results to the preceeding
command.

   Here's the verbatim command:

for i in `g.list type=raster pattern=open_h_*`; do g.rename rast=$i,`echo 
$i | sed /open_h_/blocked_h_/g`; done

(This all on one command line; split here to fit MUA width.)

   I don't see a syntax error yet it's not working here in grass-7.3.svn.
Same error message as before for each file.

Thanks,

Rich




More information about the grass-user mailing list