Reputation: 73
How can I copy files to current directory (using wildcards) which names are matches following rules:
file
.txt
extensionI tried:
$ cp path_name/file[0-9].txt ./
Here are some examples of the files I want to copy:
file1.txt
file45.txt
file5642.txt
Upvotes: 1
Views: 2605
Reputation: 1630
Try this:
cp `find /path/to/files | grep -E 'file[[:digit:]]+\.txt'` ./
(change /path/to/files
to your actual path, change ./
to your destination directory)
Upvotes: 1