LinuxQuestions.org
Visit Jeremy's Blog.
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, 05: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, 07:20 AM   #2
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware 14.1 (32 and 64 bit)
Posts: 1,587

Rep: Reputation: 121Reputation: 121
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, 07: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: 61
You should not be double posting.

$ man cp
 
Old 03-07-2007, 03: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, 04: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, 03: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, 07: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 07:46 PM.
 
Old 03-07-2007, 09:53 PM   #8
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 164Reputation: 164
Have a look at man bash and search for brace expansion.
 
Old 03-07-2007, 10: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 10:04 PM.
 
  


Reply


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


All times are GMT -5. The time now is 06:23 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration