From owner-freebsd-questions@FreeBSD.ORG Mon Feb 16 13:46:05 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 59F4F16A4DC for ; Mon, 16 Feb 2004 13:46:05 -0800 (PST) Received: from tomts13-srv.bellnexxia.net (tomts13-srv.bellnexxia.net [209.226.175.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id E7EC443D2F for ; Mon, 16 Feb 2004 13:46:04 -0800 (PST) (envelope-from dlavigne6@sympatico.ca) Received: from genisis ([64.230.83.103]) by tomts13-srv.bellnexxia.net (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP id <20040216214603.WGMO15552.tomts13-srv.bellnexxia.net@genisis> for ; Mon, 16 Feb 2004 16:46:03 -0500 Date: Mon, 16 Feb 2004 16:49:37 -0500 (EST) From: Dru X-X-Sender: dlavigne6@genisis.domain.org To: questions@freebsd.org Message-ID: <20040216163818.R609@genisis.domain.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: copying files with same name X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2004 21:46:05 -0000 Okay, I must be missing something obvious here. How do you do a batch copy while renaming the destination files? I want to copy all of the configure scripts in /usr/ports to ~/scripts. I can get find to find the files, I can get sed to rename them, but I can't get the timing down right. cp -v `find /usr/ports -name configure -print | sed 's:/:=:g'` . renames the files nicely (so they're not all named configure), but does it too soon--the source no longer exists. cp -v `find /usr/ports -name configure -print -exec sed 's:/:=:g' {} \;` . gives a syntax error (missing }) and cp -v `find /usr/ports -name configure -print | sed 's:/:=:g'` . has sed complain of extra characters at the end of a p command, followed by all my destination files being named configure. Is there a way to do this as a one-liner, or does one have to write a shell script with a while loop? Dru