regex in 'cp'

Páxina inicial
Anexos:
Mensaxe orixinal
+ (text/plain)
Borrar esta mensaxe
Responder a esta mensaxe
Autor: David A. Sinck
Data:  
Asunto: regex in 'cp'

\_ SMTP quoth Mike Starke on 9/25/2003 12:01 as having spake thusly:
\_
\_ simple one: How can I specify a range of files
\_ using cp?
\_
\_ For instance:
\_
\_ a1.ext
\_ a2.ext
\_ a3.ext
\_ a4.ext
\_ a5.ext
\_ a6.ext
\_ a7.ext
\_
\_ Now I want to move/copy a2.ext thru a6.ext
\_
\_ In practice, the range is much larger.

Actually, it's shell wildcarding that you're looking for.

cp a[2-6].ext destination

cp a[3-6][0-9][0-9].ext destination

cp a[1-8]*[0-9].ext destination

YMMV.

David