Unix/Linux Go Back    



Expansion within cp

UNIX for Dummies Questions & Answers




Kindly Note - This is a Single User Post by Forum Member jawsnnn Regarding:
Expansion within cp.
Please Follow The Primary Link Above to View the Full Discussion.

   
Old Unix and Linux 12-27-2012
jawsnnn jawsnnn is offline
Banned
 
Join Date: May 2012
Last Activity: 7 August 2015, 4:00 PM EDT
Posts: 68
Thanks: 7
Thanked 9 Times in 9 Posts
Expansion within cp

I have a bunch of files which I need to transfer to another location... and some of these I need to skip.

For e.g. let us say the files are:


Code:
cust_abc.dat
cust_xyz.dat
cust_def.dat

and I only want to move the first two.

I want to do something like:


Code:
cp cust_[/abc|xyz/].dat <target>

which doesn't work due to bad syntax. Is there some way of doing this without involving grep and xargs? I would like to do it with a single command if possible...