Couple of bash questions

JoeHill joehill-R6A+fiHC8nRWk0Htik3J/w at public.gmane.org
Sun Oct 28 17:17:42 UTC 2007


Dave Mason wrote: 

> To debug problems like this use "set -x" which causes the shell to tell
> you every command it actually executes:
> 
> ; set -x
> ; i='rescue.me.306.ws.dsr-dimension.[VTV].avi'
> + i='rescue.me.306.ws.dsr-dimension.[VTV].avi'
> ; touch "$i"
> + touch 'rescue.me.306.ws.dsr-dimension.[VTV].avi'
> ; mv "$i" "`echo X $i|sed 's/^X \([^.]*\).*\(\.[^.]*\)$/\1\2/'`"
> ++ sed 's/^X \([^.]*\).*\(\.[^.]*\)$/\1\2/'
> ++ echo X 'rescue.me.306.ws.dsr-dimension.[VTV].avi'
> + mv 'rescue.me.306.ws.dsr-dimension.[VTV].avi' rescue.avi
> ; set +x
> 
> So... WFM.  I don't know what your problem might be, but set -x will
> probably help you figure it out.

...not only that, but I just realized (and now from your response, confirmed),
that I had not been specific enough in my original question. I only want to
remove the one segment before the extension, so that
something.something.[blah].avi would come out as something.something.avi. Oops.

What I have discovered, though, is that I was not using the batch rename
function in my FM correctly. It will not allow me to replace '[blah].', but it
will allow me to replace '.[blah]', which works for me just fine.

Thanks for the tips, much appreciated :-)

-- 
JoeHill
++++++++++++++++++++
Amy: "Bender, your beer belly's so big your door won't even close. And that
 doesn't even make sense." 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://gtalug.org/pipermail/legacy/attachments/20071028/d3104dfa/attachment.sig>


More information about the Legacy mailing list