|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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... |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Based on your pattern attempt, I assume bash if you are excluding one filename Code:
# set extglob on -- shopt will show it's status shopt -s extglob cp !(def_cust).dat /somewhere The not (!) operator means do not match. You can have multiple pipe-delimited patterns See the section on 3.5.8.1 Pattern Matching here: Bash Reference Manual You may want to go with another pattern/way. |
| Sponsored Links | ||
|
![]() |
| Tags |
| regex |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help with parameter expansion | stevenswj | Shell Programming and Scripting | 3 | 10-14-2010 01:45 PM |
| Need to print the expansion of the found string (the expansion is beween two delimiters '-' , '||' | Balaji PK | Shell Programming and Scripting | 9 | 10-28-2009 06:16 AM |
| sudo and expansion | chebarbudo | UNIX for Dummies Questions & Answers | 4 | 01-22-2009 03:32 AM |
| ~ expansion in printf | Rledley | Shell Programming and Scripting | 2 | 11-15-2008 05:56 PM |
| AIX Expansion CD | almuwatta | AIX | 0 | 06-23-2005 05:07 PM |
|
|