Sunday, April 20, 2014

Re: automatically editing many .tec files

On 2014-04-20 05:48, John Little wrote:
> While I like, and use, single line do-it-all-at-once solutions,
> when there's a bunch of stuff one doesn't want to lose, or there's
> other pressures, a step by simple step approach, where one sees
> each step's results, can be good.

John does an excellent job of breaking down each of the steps. If
you want to do it in a single transformation pass, you can just do

dir /b *.tec | vim -
:%s/.\{6}\(.*\).\.tec$/ren "&" "\1.jpg"
:%!cmd

The "$" *should* be optional, but sometimes crazy things happen with
Win32 filenames (and their 8.3 shortenings), so I prefer to be
explicit.

I also went ahead and quoted the filenames in the event that any of
them have spaces in them which can cause problems otherwise.

-tim


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: