From owner-freebsd-questions@FreeBSD.ORG Wed Sep 3 19:38:23 2003 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 00E0116A4BF for ; Wed, 3 Sep 2003 19:38:23 -0700 (PDT) Received: from mailgate.sri.com (mailgate.SRI.COM [128.18.243.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 3BE0C43FE3 for ; Wed, 3 Sep 2003 19:38:22 -0700 (PDT) (envelope-from hogsett@csl.sri.com) Received: (qmail 13939 invoked from network); 4 Sep 2003 02:38:21 -0000 Received: from localhost (HELO mailgate.SRI.COM) (127.0.0.1) by mailgate.sri.com with SMTP; 4 Sep 2003 02:38:21 -0000 Received: from quarter.csl.sri.com ([130.107.1.30]) by mailgate.SRI.COM (SAVSMTP 3.1.0.29) with SMTP id M2003090319382120655 ; Wed, 03 Sep 2003 19:38:21 -0700 Received: from beast.csl.sri.com (beast.csl.sri.com [130.107.2.57]) by quarter.csl.sri.com (8.12.9/8.12.9) with ESMTP id h842cKFv021907; Wed, 3 Sep 2003 19:38:20 -0700 Message-Id: <200309040238.h842cKFv021907@quarter.csl.sri.com> To: Larry Rosenman In-Reply-To: Message from Larry Rosenman <88930000.1062638899@lerlaptop.lerctr.org> Mime-Version: 1.0 (generated by tm-edit 8.8 (Time Passed Me By)) Content-Type: text/plain; charset=US-ASCII Date: Wed, 03 Sep 2003 19:38:20 -0700 From: Mike Hogsett cc: freebsd-questions@freebsd.org Subject: Re: How do I change the extensions on a slew of files 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: Thu, 04 Sep 2003 02:38:23 -0000 > 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