Assuming I have a directory with files as shown:
$ ls
file0001.txt file0002.txt file0003.txt file0004.txt file0005.txt someotherfile.txt
Lets say I want to run the following command:
$ cat file0001.txt file0002.txt file0003.txt file0004.txt file0005.txt
I could achieve this using a bash shortcut as follows to auto-fill the file names: cat file000
ESC *
Now would it be possible to use a shortcut in a similar way to only autofill according to some regex (regular expression)? For example: cat file000[1-3]
ESC * to get:
$ cat file0001.txt file0002.txt file0003.txt
Edit: The regex I should have used above for this example to make more sense: file000[1-3].txt
or file000[1-3]*
Just to be clear my question is about how to auto-fill on the bash with regex. And NOT how I can cat
some files together using a bash script or for
/while
statements using regex.