Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 May 2000 06:45:44 -0500 (CDT)
From:      Conrad Sabatier <conrads@home.com>
To:        "Dimitrios T." <midios3@hotmail.com>
Cc:        freebsd-newbies@FreeBSD.ORG
Subject:   RE: I've tried them all. They all work :)
Message-ID:  <XFMail.000524064544.conrads@home.com>
In-Reply-To: <20000523133922.31498.qmail@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 23-May-00 Dimitrios T. wrote:
> 
> And about chopping off the .txt extension:
> 
>>Darren Wyn Rees <merlin@netlink.co.uk> adviced:
> 
>>for f in *
>>do
>>FNEW=`echo $f | sed -e 's/\.txt$//'`
>>        mv $f $FNEW
>>done
> 
> This one looks more mysterious than previous suggestions
> ( like for example:    do mv $f ${f%%.txt} done   )
> but works just fine, all of the same :) Thanks Darren!
> 
> I think I better go and look at sed's man-page once more..

Actually, there's an easier way:

for f in *
do
        mv $f `basename $f .txt`
done

man basename for more info.

-- 
Conrad Sabatier
http://members.home.net/conrads/
ICQ# 1147270



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-newbies" in the body of the message




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