copying files using as a different file name 
Author Message
 copying files using as a different file name

Hi folks. I've recently been playing with Awk, and have had some success.
However, I am at a point where I would like to take several files with the
extention .f and copy them with the same name but instead have an
extension .for . Is there any good easy way to do this? (obviously, I
don't want to do the copying by hand, cause there are too many files, and
too little time.:) )

Thanks in advance.

                                                Roger O'Rielly
                                                Chemistry student
                                                Memorial University of NFLD.



Tue, 12 Jan 1999 03:00:00 GMT  
 copying files using as a different file name

Try: awk '{print >FILENAME "or";}' *.f
If can copy *.foo to *.bar as well.
Toth Andras



Tue, 12 Jan 1999 03:00:00 GMT  
 copying files using as a different file name


Quote:
>Hi folks. I've recently been playing with Awk, and have had some success.
>However, I am at a point where I would like to take several files with the
>extention .f and copy them with the same name but instead have an
>extension .for . Is there any good easy way to do this? (obviously, I
>don't want to do the copying by hand, cause there are too many files, and
>too little time.:) )

This is a job for shell programming. The following should get you started.
Save the following four lines to a file called, say, 'myscript'
#!/bin/sh
for file in *.f
do
   cp "$file" "$file"or
done

Then do a 'chmod +x myscript' to make it executable and invoke it as
'myscript' in the directory where you want to make the changes. You might
wish to add checks to see if file.for already exists before overwriting it.

Regards,
Gora



Tue, 12 Jan 1999 03:00:00 GMT  
 copying files using as a different file name

Quote:

> Hi folks. I've recently been playing with Awk, and have had some success.
> However, I am at a point where I would like to take several files with the
> extention .f and copy them with the same name but instead have an
> extension .for . Is there any good easy way to do this? (obviously, I
> don't want to do the copying by hand, cause there are too many files, and
> too little time.:) )

This is not a job for awk, this is a shell job!  Try:

for x in *.f
do
  echo copying $x to $x'or'
  cp $x $x'or'
done

Hope this helps

--
Brian Duane - NCR Corporation
(Formerly AT&T GIS, formerly NCR)



Thu, 14 Jan 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Alias TPS with different path/file name than original file

2. DOS File Lookup - just the file name, not the path AND file name

3. (VA 4.02b) using long file names for Envy file attachments

4. Using Long File Names (TPS Files) in Clarion

5. error 37 File not open using a variable file name

6. How can I know the .EXE file name, file date, file size

7. Different Image file names in VAST 5.0

8. Merge selected columns from two different files into another file

9. Problem with adding to FILEs on different THREADS using ODBC

10. I have used the write jpeg file from intensity but image colours are different

11. I have used the write jpeg file from intensity but image colours are different

12. one file unit accessing two different files?

 

 
Powered by phpBB® Forum Software