From owner-freebsd-questions Sun Mar 7 5: 4:50 1999 Delivered-To: freebsd-questions@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 696E514F27 for ; Sun, 7 Mar 1999 05:04:26 -0800 (PST) (envelope-from ben@scientia.demon.co.uk) Received: from scientia.demon.co.uk (ident=ben) by scientia.demon.co.uk with local (Exim 2.12 #1) id 10Jc7x-000GO4-00; Sun, 7 Mar 1999 11:53:49 +0000 (envelope-from ben@scientia.demon.co.uk) Date: Sun, 7 Mar 1999 11:19:45 +0000 From: Ben Smithurst To: James Kalmadge Cc: questions@freebsd.org Subject: Re: omething simple (sorry) Message-ID: <19990307115349.A62982@scientia.demon.co.uk> References: <199903041306.NAA06501@primrose.csv.warwick.ac.uk> <36E22131.2781E494@banet.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: <36E22131.2781E494@banet.net> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG James Kalmadge wrote: > I don't know about mmv but 'basename' definitely won't work. Why not, have you actually read the manual? BASENAME(1) FreeBSD General Commands Manual BASENAME(1) NAME basename, dirname - return filename or directory portion of pathname SYNOPSIS basename string [suffix] dirname string DESCRIPTION Basename deletes any prefix ending with the last slash `/' character pre- sent in string (after first stripping trailing slashes), and a suffix, if given. > for file in *.txt > do > cp $file `echo $file | awk -F. '{print $1}'`.old > done That won't work if the file name has a dot before the .txt, part.1.txt and part.2.txt for example. -- Ben Smithurst ben@scientia.demon.co.uk send a blank message to ben+pgp@scientia.demon.co.uk for PGP key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message