Search code examples
bashunixglob

Globbing files having single different character in filename


I have couple of files of the format,

unit-a.test.one.two
unit-b.test.one.two
unit-c.test.one.two

and I want to move all the files to make the filename

unit-a.test.one.sample.two
and so on.

While I know that using a globbing of the type

unit-*

will match all the files, I was wondering if there is a better solution to match the filenames since this method will also incorrectly match files of the type

unit-1.txt

Which is undesirable.


Solution

  • Why not using unit-?.test.one.two ?