Date: Wed, 03 Sep 2003 22:10:14 -0500 From: Larry Rosenman <ler@lerctr.org> To: Mike Hogsett <hogsett@csl.sri.com> Cc: freebsd-questions@freebsd.org Subject: Re: How do I change the extensions on a slew of files Message-ID: <158370000.1062645014@lerlaptop.lerctr.org> In-Reply-To: <200309040238.h842cKFv021907@quarter.csl.sri.com> References: <200309040238.h842cKFv021907@quarter.csl.sri.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--On Wednesday, September 03, 2003 19:38:20 -0700 Mike Hogsett
<hogsett@csl.sri.com> wrote:
>
>> from an sh type shell
>> for i in *.inc
>> do
>> z=`echo $i | sed -e "s/inc/htm/g"`
>> mv ${i} ${z}
>> done
>
> This won't give expected results for a file named "fooinc.inc". It will
> become "foohtm.htm". I realize that based on the file names given in the
> original email this doesn't appear to be an issue, but changing the sed
> command to
>
> sed -e 's/\.inc$/\.html/'
>
> may give better (more generally useful) results. Also note the ' instead
> of " so that the shell doesn't perform variable expansion within the sed
> command text. The shell will ignore the $ and instead sed uses it to match
> end of line or string in this case.
>
> - Mike
thanks, Mike. What you bring up, is of course, valid.
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?158370000.1062645014>
