On Sat, 11 Feb 2012 04:51:02 -0900,
fl...@apaflo.com (Floyd L. Davidson) wrote:
>Grant <
o...@grrr.id.au> wrote:
>>On Thu, 09 Feb 2012 09:53:13 -0900,
fl...@apaflo.com (Floyd L. Davidson) wrote:
>>
>>>Grant <
o...@grrr.id.au> wrote:
>>>>Recently somebody suggested 'rename' as a solution to something I
>>>>forgot, but after a couple tries 'rename' to remove "_01" from 234
>>>>filenames, I resorted to simple CLI stuff:
>>>
>>>Not sure if this is better than other solutions, but the way I've
>>>always done something like that just uses parameter substitution
>>>in the bash shell:
>>>
>>> > for i in *_01.JPG ; do mv "${i}" "${i%%_01.JPG}.JPG" ; done
>>
>>Problem for me is I always forget how the name-chopping (%%) works,
>>so do it another way to save trying to work out the syntax.
>>>
>>>There are a number of pattern matching substitutions possible,
>>>and while that one is the one most often used for filename changes,
>>>sometimes others can also be useful.
>>
>>Many ways, I tend to fall back to simple brute force ways when I
>>get stuck. Unless I'm trying to optimise for performance.
>
>That particular one, using "%%", is the only one that I can always
>remember exactly how to use. Half the time with anything else
>I have to look it up. But... I use XEmacs, and looking it up
>is just another editor command to get the bash man page and then
>do a search to get to the right occurance of "%%", from which I
>can page up or down to find the others.