Using regular expressions with cp
The UNIX shell uses glob patterns, not regular expressions. So, if you want to match file names starting with axis2
and ending with .jar
, you use:
cp axis2*.jar /destination/directory
If you have GNU find
and GNU cp
available, you can use regular expressions as in the following command:
find . -maxdepth 1 -regextype posix-basic -regex '.*/axis2[^/]*jar$' \
-exec cp -t ~/MyDirectory {} +
This can be handy if neither glob pattern nor bash extended glob pattern suite your needs.