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:

CGI Request Time Out (1997) Summing fields (1997) URL too Long? (1997) [OT] SSL (2003) Internet Explorer 6 Form problems (2005) Add more fields to an existent data base (1997) grep twice or a better way.... (2007) Location of Browser Info.txt file (1997) Setting up WebCatalog with Retail Pro data (1996) WC2.0 Memory Requirements (1997) Outsourcing partnership ... (2005) Alternative colors? (2000) Combining search criteria (2000) problems with 2 tags (1997) Where's Cart Created ? (1997) Other tags inside the founditems context? (1998) RAM variables (1997) WebCat2b12 CGI Mac -- Problems propagating the cart through frames...still (1997) [WebDNA] weekday question (2013) BUG: Random sort is not random at all..... (2000)