Computing.Net > Forums > Unix > Foreach to cp files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Foreach to cp files

Reply to Message Icon

Name: nmf
Date: June 22, 2006 at 21:38:58 Pacific
OS: OS x
CPU/Ram: G4
Product: emac
Comment:

I'm trying to duplicate a template file into all files that
have *mo.sed.

foreach is (\*mo.sed)
cp ok.sed $is
endeach

gives a cp error
if I try ls instead of cp, it lists all the files correctly.




Sponsored Link
Ads by Google

Response Number 1
Name: Devaraj (by Fidy)
Date: June 23, 2006 at 10:26:24 Pacific
Reply:

use

for i in $(ls *.mo.sed)
do
cp ok.sed $i
done

Regards,
Jern


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Foreach to cp files

Simple script to copy files www.computing.net/answers/unix/simple-script-to-copy-files/4521.html

script to change file names www.computing.net/answers/unix/script-to-change-file-names/8327.html

How to copy files and replace it. www.computing.net/answers/unix/how-to-copy-files-and-replace-it/8441.html