LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] vi tip...

[ILUG] vi tip...

kevin lyda kevin+dated+1082456802.8afea6 at ie.suberic.net
Thu Apr 15 11:26:33 IST 2004


for vi users who don't know about recording...

ok, for years i'd accidentally type q and then there'd be this annoying
"recording" thing in the bottom left.  so i finally went and figured out
how to use it.  let's say you have this file:

    http://moo/images/img_0123.jpg
    http://moo/images/img_0145.jpg
    http://moo/images/img_0167.jpg
    http://moo/images/img_0170.jpg
    http://moo/images/img_0212.jpg

and you want to change jpg to jpeg, remove the leading 0, and increment
each number by 10.  i know, a contrived example, but for demo purposes...

the way recording works is you press q<letter><a series of commands>q
to record.  and @<letter> to play the recorded commands back.

so to do this task we'll do this:

    start recording in recording buffer a        qa
    search for jpg                               /jpg<return>
    change it to jpeg                            cwjpeg<esc>
    go to the 0                                  F_l
    delete it                                    x
    increment it by 10                           10<C-a>
    end recording                                q

then rerun the recording with @a for each remaining line:

    http://moo/images/img_133.jpeg
    http://moo/images/img_155.jpeg
    http://moo/images/img_177.jpeg
    http://moo/images/img_180.jpeg
    http://moo/images/img_222.jpeg

kevin

-- 
kevin at ie.suberic.net  ~  Would you put on your resume that 3,000 people
                         died due to your failure while you were in charge?

                         So why is George Bush?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.linux.ie/pipermail/ilug/attachments/20040415/10aaf5c3/attachment.pgp


More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell