LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-18-2004, 12:22 PM   #1
Radical-Rick
LQ Newbie
 
Registered: Apr 2004
Posts: 4

Rep: Reputation: 0
copy a file to mutiple files


Hi
I need help with a copy script to perform the following. Any help will be greatly appreciated.

I have a directory with a file named orig.ext

I also have a list containg
new1
new2
new3
new4

I need to copy orig.ext to new1.ext, new2.ext, new3.ext & new4.ext.


Thanks Rick
 
Old 04-18-2004, 12:43 PM   #2
mardanian
Member
 
Registered: Mar 2004
Distribution: Fedora
Posts: 254

Rep: Reputation: 30
#!/bin/sh
forÂ_iÂ_inÂ_0Â_1Â_2Â_3Â_4Â_5Â_6Â_7Â_8Â_9Â_;Â_do
Â_Â_Â_Â_Â_Â_Â_Â_cpÂ_$1Â_$1.BAK-$i
done

create a file important_data with anything in it and then run ./backup-lots.shÂ_important_data, which will copy the file 10 times with 10 different extensions.
this is what i thinks you asking for
 
Old 04-18-2004, 12:45 PM   #3
mardanian
Member
 
Registered: Mar 2004
Distribution: Fedora
Posts: 254

Rep: Reputation: 30
Oops here it is again

#!/bin/sh
for i in 0 1 2 3 4 5 6 7 8 9;do
cp $1 $1.BAK-$i
done
 
Old 04-18-2004, 03:44 PM   #4
Radical-Rick
LQ Newbie
 
Registered: Apr 2004
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks mardanian for the reply.

I also figured another way.

cat list | xargs -i cp orig.ext '{}'.ext

Rick
 
Old 07-11-2006, 03:32 PM   #5
haleh_space
LQ Newbie
 
Registered: Jul 2006
Posts: 1

Rep: Reputation: 0
question !!!

Quote:
Originally Posted by mardanian
Oops here it is again

#!/bin/sh
for i in 0 1 2 3 4 5 6 7 8 9;do
cp $1 $1.BAK-$i
done


Dear Mardanian would u plz tell me yur first name ? if u want u can mail me and tell me , it will be nice to meet u
haleh >> email removed

Last edited by acid_kewpie; 07-14-2006 at 06:50 AM.
 
Old 07-11-2006, 03:34 PM   #6
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Rep: Reputation: 30
Quote:
Originally Posted by haleh_space
Dear Mardanian would u plz tell me yur first name ? if u want u can mail me and tell me , it will be nice to meet u
haleh >> email removed
this is a weird post.... why would you suggest that?

Last edited by acid_kewpie; 07-14-2006 at 06:51 AM.
 
Old 07-11-2006, 03:47 PM   #7
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Because someone wants mardanian to receive spam, I guess. Don't you get lots of emails that look similar? I'll report that post.
 
  


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
Command to select and move mutiple files from list in text file steve.paris Linux - Newbie 11 11-27-2005 12:44 PM
copy many files stored in a file dominant Linux - Newbie 3 11-12-2004 04:49 AM
Knode and mutiple file downloading. rar and redhat xviddivxoggmp3 Linux - Software 0 07-13-2004 04:18 PM
How to do recursive file copy of directory for specific files? Arodef Linux - Newbie 4 06-29-2004 05:35 PM
copy multiple files into one file HelpPlease Programming 2 12-09-2003 02:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:47 PM.

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