-4

I know there are different questions about this topic but I have found nothing that fits my question:

I want to replace a part of a name in a folder but there are different files with different names. Only a part of them should be replaced:

This files should be change from sst_... to sstk_... but in the same folder are other different files like:

sst_20170420_3h.nc
sst_20170421_3h.nc
sst_20170422_3h.nc
sst_20170423_3h.nc
blh_20170420_3h.nc
blh_20170420_3h.nc
.
.
.

the length is different for every folder...

Can someone help me?

Humberto Castellon
  • 879
  • 1
  • 7
  • 17
  • There seem to be several file rename tools for ubuntu and also script examples for operations like this. Have you checked any of them? – marsh-wiggle Nov 23 '18 at 16:51

1 Answers1

3
cd yourdirectory
for i in $(ls -1); do mv $i $(echo $i | sed 's/sst/sstk/') ; done
Dmitriy Kupch
  • 471
  • 2
  • 6