Re: How do I change the extensions on a slew of files
--On Friday, September 12, 2003 17:11:50 -0700 James Long [EMAIL PROTECTED] wrote: On Wed, Sep 03, 2003 at 08:28:19PM -0500, Larry Rosenman wrote: from an sh type shell for i in *.inc do z=`echo $i | sed -e s/inc/htm/g` mv ${i} ${z} done (not tested, but should work.) LER What does it do with a file named include.inc z=`echo $i | sed -e s/inc$/htm/g` is better, no? Yep, and some other kind folks pointed this out. Thanks, LER -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED] US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 pgp0.pgp Description: PGP signature
How do I change the extensions on a slew of files
Hello Know-It-Alls, If I have a directory with a whole slew of files with the same file extension, for example: 1-1-1.inc 1-1-2.inc 1-1-3.inc etc. What command can I use to change the file extension - but keep the file name the same - in one swell swoop? The equivalent command in Windows would be: C:\ren *.inc *.htm Jonas Fornander - System Administrator Netwood Communications,LLC - www.netwood.net Find out why we're better - 310-442-1530 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How do I change the extensions on a slew of files
--On Wednesday, September 03, 2003 18:25:07 -0700 Jonas [EMAIL PROTECTED] wrote: Hello Know-It-Alls, If I have a directory with a whole slew of files with the same file extension, for example: 1-1-1.inc 1-1-2.inc 1-1-3.inc etc. What command can I use to change the file extension - but keep the file name the same - in one swell swoop? The equivalent command in Windows would be: C:\ren *.inc *.htm Jonas Fornander - System Administrator Netwood Communications,LLC - www.netwood.net Find out why we're better - 310-442-1530 from an sh type shell for i in *.inc do z=`echo $i | sed -e s/inc/htm/g` mv ${i} ${z} done (not tested, but should work.) LER ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED] US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
RE: How do I change the extensions on a slew of files
Hello Know-It-Alls, If I have a directory with a whole slew of files with the same file extension, for example: 1-1-1.inc 1-1-2.inc 1-1-3.inc etc. What command can I use to change the file extension - but keep the file name the same - in one swell swoop? The equivalent command in Windows would be: C:\ren *.inc *.htm Jonas Fornander - System Administrator Netwood Communications,LLC - www.netwood.net Find out why we're better - 310-442-1530 from an sh type shell for i in *.inc do z=`echo $i | sed -e s/inc/htm/g` mv ${i} ${z} done (not tested, but should work.) LER Tested and it works great! Thanks. Jonas Fornander - System Administrator Netwood Communications,LLC - www.netwood.net Find out why we're better - 310-442-1530 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How do I change the extensions on a slew of files
On Wed, Sep 03, 2003 at 06:25:07PM -0700, Jonas wrote: Hello Know-It-Alls, If I have a directory with a whole slew of files with the same file extension, for example: 1-1-1.inc 1-1-2.inc 1-1-3.inc etc. What command can I use to change the file extension - but keep the file name the same - in one swell swoop? The equivalent command in Windows would be: C:\ren *.inc *.htm The shortest answer is probably: portinstall mmv; mmv *.inc =1.htm - Till ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
RE: How do I change the extensions on a slew of files
Hello Know-It-Alls, If I have a directory with a whole slew of files with the same file extension, for example: 1-1-1.inc 1-1-2.inc 1-1-3.inc etc. What command can I use to change the file extension - but keep the file name the same - in one swell swoop? The equivalent command in Windows would be: C:\ren *.inc *.htm The shortest answer is probably: portinstall mmv; mmv *.inc =1.htm Another option might be: # Ls directory with files you need to change extensions | while read file ; do mv $file.inc $file.htm done press Enter # ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
RE: How do I change the extensions on a slew of files
--On Wednesday, September 03, 2003 18:56:15 -0700 Jonas [EMAIL PROTECTED] wrote: Tested and it works great! Cool. That was off the top of my head using standard system tools. Enjoy. Welcome to FreeBSD and Unix and Unix-Like OS'. Larry Thanks. My pleasure. -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED] US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How do I change the extensions on a slew of files
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 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How do I change the extensions on a slew of files
--On Wednesday, September 03, 2003 19:38:20 -0700 Mike Hogsett [EMAIL PROTECTED] 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: [EMAIL PROTECTED] US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]