How to make a reference to what was matched in glob pattern

With regexes you can put a capturing group and refer to it in your action (i.e. \1). Is there something similar for when glob is used in bash?

Say I have files named 'file1', 'file2', 'file3', and I want to rename them to 'foo1', 'foo2', 'foo3'. I'd like to do something like this:

mv file(?) foo\1

is that possible?


You're looking for batch renaming. There are a lot of solutions here on stackoverflow. Here is one example

Need Your Help

Matlab equivalent of `endsWith`: How to filter list of filenames regarding their extension?

python regex matlab

Is there a MATLAB equivalent of the endswith function available in Python, Java etc.?

using different layouts for an entire controller

ruby-on-rails layout iframe ruby-on-rails-3

I'm having problems with something that should be simple.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.