LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to use CP command (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-use-cp-command-535008/)

ajaz_javeed 03-06-2007 04:56 AM

How to use CP command
 
Hello everybody,

I have a bunch of files named bkp1.arch to bkp99.arch.

I want to copy just files numbered bkp11.arch to bkp92.arch.

What is the exact CP command in this situation ?

Thanks and Regards
AJAZ

titopoquito 03-06-2007 06:20 AM

What you could use is the "seq" command ("man seq" for information about it).

This could lead to:

Code:

for number in $(seq 11 92); do cp bkp${number}.arch /target/path; done

rickh 03-06-2007 06:38 AM

You should not be double posting.

$ man cp

ajaz_javeed 03-07-2007 02:57 AM

Hello Titopoquito,

You have really assisted me in solving the problem. The command worked perfectly and made my life much easier.

Thanks a lot

Thank you
AJAZ

ygloo 03-07-2007 03:05 AM

hello,
Code:

cp bkp{11..92}.arch dir

szp 03-07-2007 02:22 PM

Loving ygloo's way - I had to try it out, seemed to beautiful to be true. Thanks.

7stud 03-07-2007 06:26 PM

Quote:

Originally Posted by ygloo
hello,
Code:

cp bkp{11..92}.arch dir

Is there any documentation for the construct {11..92} anywhere?

gilead 03-07-2007 08:53 PM

Have a look at man bash and search for brace expansion.

ygloo 03-07-2007 09:02 PM

yap, it's all there in manual,
there are a lot of examples here:
http://tldp.org/LDP/abs/html/index.html

try this:
echo {a..z}


All times are GMT -5. The time now is 03:09 AM.