now i have 4 file where each file has key,value data , now i want to compare all the files get all the lines which have common keys in it , say
file1 file2 file3 file
tim,chase tom,someting tom,wright chase,w
tom,jerry vinay,b sachin,b tom,m
out put would be
tom,chase
tom,jerry
tom,wright
tom,m
is this possible in vim
On Wed, Nov 7, 2012 at 7:26 PM, Tim Chase <vim@tim.thechases.com> wrote:
On 11/07/12 07:07, vicky b wrote:Well, there are a couple options, again using ":argdo" to iterate
> I was able to do that but i have some unwanted lines in a file
>
> i just want line that have a pattern , below is the file
>
> #Generated by ResourceBundle Editor
> # en Resource Bundle
> #
> # filename: FormsNRefsPortletResource_en.properties
> # Portlet Info resource bundle example
> Matches , \u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A
> Select , \u0E40\u0E25\u0E37\u0E2D\u0E01
> choice1Label ,
> \u0E40\u0E02\u0E49\u0E32\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E23\u0E31\u0E01\u0E29\u0E32
>
>
> desired file should be like
>
> Matches , \u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A
> Select , \u0E40\u0E25\u0E37\u0E2D\u0E01
> choice1Label ,
> \u0E40\u0E02\u0E49\u0E32\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E23\u0E31\u0E01\u0E29\u0E32
>
>
> that i want lines whic have \u0E15 these kind of stsring others i want to
> delete
over all the files. If you want to keep lines that contain
"backslash u hex-digit hex-digit hex-digit hex-digit", you can do
:set hidden
:argdo v/\\u\x\x\x\x/d
then review your changes and either save/abandon the changes.
Alternatively, if you have your original file and just want to keep
the "=" lines even if they don't have hex digits on them (might be
integers or something else?), you can preprocess with
:argdo v/=/d
to delete all the lines that don't contain an "=". You can then run
the previously-provided command to change the "=" to ",".
If you just want to delete those lines starting with a hash, you can use
:argdo g/^\s*#/d
to delete them.
-tim
Thanks & Regards
Vickyb
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:
Post a Comment