3

I want to rename name of files test123..-1.in, test123..-2.in, etc. to test123.in.

I tried commands:

rename -/d.in .in *.in, and many of similar but no one works(Can You explain why?). Then i tried rename 's/.[0-9]*.in$/.in/' *.in, with same result..

Any proposition how to solve this problem in the simple way? I dont wanna write it mannualy.

Thanks for Your help.

  • 2
    Why do you want to rename every file to test123.in? There will be only one file at the end of execution. – Gurupad Hegde Dec 14 '15 at 14:29
  • Do you actually want to rename files to have the same file name (which makes no sense), or do you want to merge several files into one file? – McVenco Dec 14 '15 at 14:35
  • No, I have many test files, that why i wrote test123... with points. They accualy will be like test12345-5, test12346-3, test12353-2 etc. and i want them be only like test12345, test12346, test12353. – Bartek Błazik Dec 15 '15 at 14:48

1 Answers1

1

You can use this rename:

rename 's/\.+-\d+\././' test123..-*in

or as per OP's comment below:

rename 's/-\d+\.in/.in/' *.in
anubhava
  • 761,203
  • 64
  • 569
  • 643