Re: [OT] Command Line Change Name

This WebDNA talk-list message is from

2004


It keeps the original formatting.
numero = 59665
interpreted = N
texte = on 10/19/2004 3:20 pm, Donovan Brooke at dbrooke@euca.us so noted... > I need to change a bunch of image file names within a directory. > > They are labeled like: > > d_something.jpg > d_someotherthing.jpg > > (all starting with "d_"). > > Is there a grep (or other) solution that will find all > these images in a directory and then change the "d_" to a > "t_"? Here's one way. Navigate to the directory in the Terminal and enter on one line: ls | awk '{print("mv "$1)}' | sed 's/d_\(.*\)/d_\1 t_\1/' | /bin/sh You can also remove the " | /bin/sh" from the end to print out the commands without executing them (to make sure the command will do what you want it to do before actually running it). Rob Marquardt Designer/Resident Wirehead Toast Design 800 Washington Avenue North Minneapolis MN 55401 612.330.9863 v 612.321.9424 f www.toastdesign.com ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: [OT] Command Line Change Name ( Donovan Brooke 2004)
  2. Re: [OT] Command Line Change Name ( Rob Marquardt 2004)
  3. [OT] Command Line Change Name ( Donovan Brooke 2004)
on 10/19/2004 3:20 pm, Donovan Brooke at dbrooke@euca.us so noted... > I need to change a bunch of image file names within a directory. > > They are labeled like: > > d_something.jpg > d_someotherthing.jpg > > (all starting with "d_"). > > Is there a grep (or other) solution that will find all > these images in a directory and then change the "d_" to a > "t_"? Here's one way. Navigate to the directory in the Terminal and enter on one line: ls | awk '{print("mv "$1)}' | sed 's/d_\(.*\)/d_\1 t_\1/' | /bin/sh You can also remove the " | /bin/sh" from the end to print out the commands without executing them (to make sure the command will do what you want it to do before actually running it). Rob Marquardt Designer/Resident Wirehead Toast Design 800 Washington Avenue North Minneapolis MN 55401 612.330.9863 v 612.321.9424 f www.toastdesign.com ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Rob Marquardt

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Passing WebCat Vars with Javascript (2000) Server2003 and IIS 6.0 issues (2005) Mac: LModelDirector bug fix (1997) WebCatalog NT beta 18 problem (1997) locking variables? (2000) A few questions. . . (1997) The beginning (1997) Concatenating Form Variables (1998) Protect vs Authenicate (1997) WebCat2b12--[searchstring] bug (1997) WebCat2b12 CGI Mac - [shownext] problem (1997) AJAX with WebDNA (2006) Browser Info.txt (1997) Webcat deletes last line from Excel-saved text db (2004) nesting limits? (1998) Error.html (1997) Re[2]: Emailed problem (2000) [WriteFile] problems (1997) page redirect in webDNA (1997) Cart Template (1997)