On Mon, May 23, 2005 at 09:28:11AM -0400, Claude Jones wrote: > On Mon May 23 2005 8:33 am, Jeff Kinz wrote: > > On Mon, May 23, 2005 at 03:43:53AM -0400, Claude Jones wrote: > > > I would like to add a 0 to each group of three numbers at the beginning > > > of each name so that 001-Fig 1-1.jpg becomes 0010-Fig 1--1.jpg for > > > example. Could someone help me with the quick way to do this? > > > > Hi Claude. > > I see you've received some solutions on this so I won't add to them, but > > I do want to correct your terminology. > > > > This isn't a programming question. Its a scripting question. > > Thanks everyone for your replies. Jeff, I have to further correct your > correction. Instead of 'small scripting question' it should have been > 'scripting question' - by all of the responses I got, this certainly turned Hi Claude, My new subject line for the thread was "Scripting question", i never said small. That was the old subject line. Go back and read again. (nevertheless, this is a small scripting question, you're just new to it) > out to be more complicated than I'd thought. Nothing small about it, at least > for me. Its completely normal to be a little confused or inspired by the power and flexibility which regular expressions brings to the editor. The regex utilities (yes, there are more than one of them), make an incredible amount of power and utility available at the cost of just a few keystrokes. Which is wonderful, and dangerous at the same time. Simple regex's like these will eventually become second nature to you, and then you'll start thinking about creating conditional, multi-field, branching Regex's. Those will actually be complicated. > I never did get Oliver's suggestion to work. I tried Bob Chiodini's > next and it worked on the first try. I'm just getting started on a book on > Bash which is what lead me to ask the question but it didn't even occur to me > that the answer would involve perl or some of the other suggestions ed,ex,sed,vi, vim. emacs, perl and many other utilities include regex capabilities. They are so useful and powerful that it makes sense to have them available in many places, especially since the library is already written. You can even use regex's in real programs. See: man 3 regex, man 3 regcomp -- Jeff Kinz, Emergent Research, Hudson, MA.