HattrickNZ
HattrickNZ

Reputation: 4653

copy multiple files with certain prefixs

How do i copy files with with the certain prefixs e.g. LTE*.html, Voicemail*.html

$ ls
2G_3G_cccccc.html  other_dddd.html   other3_dddd.html  Voicemail_bbbbbb.html
LTE_aaaa.html      other2_dddd.html  subdir1

I have tried this but no joy

$ cp '(LTE*|Voice*).html' subdir1/
cp: cannot stat `(LTE*|Voice*).html': No such file or directory

So this would be the result I want

$ ls subdir1/
Voicemail_bbbbbb.html    LTE_aaaa.html

Upvotes: 0

Views: 44

Answers (1)

Reinstate Monica Please
Reinstate Monica Please

Reputation: 11593

Use brace expansion

cp {LTE,Voice}*.html subdir1/

Which expands to

cp LTE*.html Voice*.html subdir1/

Upvotes: 1

Related Questions