![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multi File processing | orahi001 | Shell Programming and Scripting | 2 | 01-10-2008 04:49 PM |
| Strange difference in file size when copying LARGE file.. | 0ktalmagik | Filesystems, Disks and Memory | 1 | 06-03-2006 08:34 PM |
| multi file editing in vi | ricl999 | Shell Programming and Scripting | 0 | 04-21-2006 08:23 AM |
| Multi User Multi Task | Reza Nazarian | UNIX for Dummies Questions & Answers | 6 | 04-13-2006 10:23 AM |
| multi-file multi-edit | kielitaide | UNIX for Dummies Questions & Answers | 12 | 06-28-2001 04:12 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hello there,
I am writting a scrip with in shell (#!/bin/sh) and I need to copy 5 times the same file into different names: Code:
cp xsec.1.11 xsec.1.12 cp xsec.1.11 xsec.1.13 cp xsec.1.11 xsec.1.14 cp xsec.1.11 xsec.1.15 cp xsec.1.11 xsec.1.16 Thanks for your help. |
|
||||
|
Not directly. Use a loop, perhaps?
Code:
for f in 12 13 14 15 16; do cp xsec.1.11 xsec.1.$f done |
|
||||
|
Thanks for your answers.
Unfortunately I had already though using a loop but I still needed as many lines to do the job...(If I had to make 1000 copies that would be definitely better, but for 5 or 6...). In fact I wanted to make sure there was not a built-in function capable to do that! ![]() |
|
|||||
|
Quote:
Code:
while read file
do
i=12
while [ $i -lt 17 ]
do
cp -p "$file" /other/dir/"${file%.*}.$i"
i=$(($i + 1))
done
done < files_list
Code:
$ cat files_list xsec.1.11 xsec.2.11 xsec.3.11 ... |
|
||||
|
I dunno if what I need is in the sort of same lines as this but I need to copy all *.txt files to a directory but change any reacurring names eg like multi readme.txt would have to rename as to keep all files
|
|
|||||
|
Quote:
It might be better to open a new thread for your problem. Also post a clear sample of your input, expected output, and your efforts so far. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|