LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 03-06-2007, 04:56 AM   #1
ajaz_javeed
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
AJAZ
 
Old 03-06-2007, 06:20 AM   #2
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,645

Rep: Reputation: 146Reputation: 146
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
 
Old 03-06-2007, 06:38 AM   #3
rickh
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, 02:57 AM   #4
ajaz_javeed
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
AJAZ
 
Old 03-07-2007, 03:05 AM   #5
ygloo
Member
 
Registered: Aug 2006
Distribution: slack
Posts: 323

Rep: Reputation: 30
hello,
Code:
cp bkp{11..92}.arch dir
 
Old 03-07-2007, 02:22 PM   #6
szp
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, 06:26 PM   #7
7stud
LQ Newbie
 
Registered: Feb 2007
Posts: 22

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

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

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

Rep: Reputation: 30
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}

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


Reply



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 07:19 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
Key stroke/command to shut down x and go into the command prompt screen? Fear58 Linux - General 1 07-14-2004 07:14 PM
Command to display whole filestructure hierarchy f/ command line? mjewell Linux - Newbie 10 01-19-2004 10:48 AM
Where is Command line utility for Cups and command tutorial mossy Linux - Software 8 01-16-2004 12:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:43 AM.

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