Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Mar 1999 11:19:45 +0000
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        James Kalmadge <kalmadg@banet.net>
Cc:        questions@freebsd.org
Subject:   Re: omething simple (sorry)
Message-ID:  <19990307115349.A62982@scientia.demon.co.uk>
In-Reply-To: <36E22131.2781E494@banet.net>
References:  <199903041306.NAA06501@primrose.csv.warwick.ac.uk> <36E22131.2781E494@banet.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990307115349.A62982>