-1

The files have a common pattern.

feed_predict.data.4.202.0
feed_predict.mdl.4.202.0
feed_predict.so.4.202.0
feed_predict.xml.4.202.0

I want to move files in batches.

for x in feed_predict{.*}4.202.0;
    //ls $x //nothing prints here
    sudo mv $x $1.4.17.0;
end

But $x is empty here.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
mariolu
  • 624
  • 8
  • 17

1 Answers1

1

You can use basename with the old suffix to strip it from the filename and then concatenate it with the new suffix:

for x in feed_predict.*.4.202.0;
    sudo mv $x (basename $x .4.202.0).4.17.0
end
August Karlstrom
  • 10,773
  • 7
  • 38
  • 60