Wednesday, January 26, 2011

Re: How can I do this?

David Fishburn <dfishburn.vim@gmail.com> [11-01-26 17:14]:
> On 1/25/2011 1:08 PM, meino.cramer@gmx.de wrote:
> >Hi,
> >
> >sorry for being not more specific in the Subject line
> >to my posting -- I didnt want to put the whole into
> >it... ;)
> >
> >I have two files. One "master" and one "copy".
> >
> >Both consists of lines like this
> >
> ><category> <parameter> <value>
> >
> >' ' is a simply space
> >
> >The<parameter> consists of<word1>-<word2>-<word3>, where the count
> >of different words is not constant over the lines.
> >
> >Now I want to replace all lines in the "copy"-file, which have a
> >certain<word> in its parameter with the line of the "master"-file
> >with the same "<category> <parameter>" combination in it.
> >
> >There may be lines in the "copy"-file with parameters matching
> ><word> which do not have a counterpart in the "master"-file.
> >Those should be printed.
> >
> >Is this possible within vim?
> >
> Yes, possible, but you would have to write Vim script to do it.
>
> If you are interested in writing this (i.e. you will have to do this
> many times over the years, not just once), then I would suggest you
> start with my WhatsMissing plugin:
> http://vim.sourceforge.net/scripts/script.php?script_id=1108
>
> It does some of what you want:
> 1. Cycles through a number of words in the master file
> 2. Switches buffers to the slave file
> 3. Checks if the word exists
> 4. Writes out the "missing" (or "not missing") words to another buffer
> 5. Switches back to the master file and moves to the next word
>
> You can easily modify that logic to do what you need where the basic
> logic stays the same.
>
> Best of luck.
> Dave
>
> --
> 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

Hi Dave,

thank you for reply and the hint to the script! :)

Best regards,
mcc

--
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

No comments: