Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-06-2007, 05:56 AM   #1
LQ Newbie
Registered: Jan 2007
Posts: 24

Rep: Reputation: 15
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
Old 03-06-2007, 07:20 AM   #2
Senior Member
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,609

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

This could lead to:

for number in $(seq 11 92); do cp bkp${number}.arch /target/path; done
Old 03-06-2007, 07:38 AM   #3
Senior Member
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
You should not be double posting.

$ man cp
Old 03-07-2007, 03:57 AM   #4
LQ Newbie
Registered: Jan 2007
Posts: 24

Original Poster
Rep: Reputation: 15
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
Old 03-07-2007, 04:05 AM   #5
Registered: Aug 2006
Distribution: slack
Posts: 323

Rep: Reputation: 30
cp bkp{11..92}.arch dir
Old 03-07-2007, 03:22 PM   #6
LQ Newbie
Registered: Aug 2006
Distribution: Slackware 11
Posts: 6

Rep: Reputation: 0
Loving ygloo's way - I had to try it out, seemed to beautiful to be true. Thanks.
Old 03-07-2007, 07:26 PM   #7
LQ Newbie
Registered: Feb 2007
Posts: 22

Rep: Reputation: 15
Originally Posted by ygloo
cp bkp{11..92}.arch dir
Is there any documentation for the construct {11..92} anywhere?

Last edited by 7stud; 03-07-2007 at 07:46 PM.
Old 03-07-2007, 09:53 PM   #8
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,138

Rep: Reputation: 168Reputation: 168
Have a look at man bash and search for brace expansion.
Old 03-07-2007, 10:02 PM   #9
Registered: Aug 2006
Distribution: slack
Posts: 323

Rep: Reputation: 30
yap, it's all there in manual,
there are a lot of examples here:

try this:
echo {a..z}

Last edited by ygloo; 03-07-2007 at 10:04 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 08:19 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 03:23 AM
Key stroke/command to shut down x and go into the command prompt screen? Fear58 Linux - General 1 07-14-2004 08:14 PM
Command to display whole filestructure hierarchy f/ command line? mjewell Linux - Newbie 10 01-19-2004 11:48 AM
Where is Command line utility for Cups and command tutorial mossy Linux - Software 8 01-16-2004 01:24 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration