Erwin Pombett
asked on
with vimgrep - or other vim possibility - how can i get groups of data out of a file ?
Hello every one.
I'm trying to do a vimgrep on a file in order to get only two attributs with their values out of the xml file.
so far i can get the complete lines and i'd like with the help of groups to have a better display.
:vimgrep key= % | copen
^ I'd like to add to this command the grouping possibility with "\( \)" ....but without success for the moment.
i'd appreciate your help in order to have a result as explained in the "result expected"
part of the file that I'm working with :
.......................... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... ...
<policy name="Menu_Controls" class="User" displayName="$(string.Menu _Controls) " explainText="$(string.IE_E xplainMenu _Controls) " presentation="$(presentati on.Menu_Co ntrols)" key="Software\Policies\Mic rosoft\Win dows\Curre ntVersion\ Internet Settings\AllowedControls">
<parentCategory ref="AdminApproved" />
<supportedOn ref="SUPPORTED_IE5" />
<elements>
<boolean id="MCSiMenu" valueName="{275E2FE0-7486- 11D0-89D6- 00A0C90C9B 67}">
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
<boolean id="PopupMenu_Object" valueName="{7823A620-9DD9- 11CF-A662- 00AA00C066 D2}">
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
<boolean id="Ikonic_Control" valueName="{F5131C24-E56D- 11CF-B78A- 4445535400 00}">
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
</elements>
</policy>
<policy name="Microsoft_Agent" class="User" displayName="$(string.Micr osoft_Agen t)" explainText="$(string.IE_E xplain_Mic rosoft_Age nt)" presentation="$(presentati on.Microso ft_Agent)" key="Software\Policies\Mic rosoft\Win dows\Curre ntVersion\ Internet Settings\AllowedControls">
<parentCategory ref="AdminApproved" />
<supportedOn ref="SUPPORTED_IE5" />
<elements>
<boolean id="Microsoft_Agent_Contro l" valueName="{D45FD31B-5C6E- 11D1-9EC1- 00C04FD708 1F}">
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
</elements>
</policy>
.......................... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... ...
my expected result :
.......................... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... ...
name="Menu_Controls" key="Software\Policies\Mic rosoft\Win dows\Curre ntVersion\ Internet Settings\AllowedControls"
name="Microsoft_Agent" key="Software\Policies\Mic rosoft\Win dows\Curre ntVersion\ Internet Settings\AllowedControls"
......
.......................... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... ...
I'm trying to do a vimgrep on a file in order to get only two attributs with their values out of the xml file.
so far i can get the complete lines and i'd like with the help of groups to have a better display.
:vimgrep key= % | copen
^ I'd like to add to this command the grouping possibility with "\( \)" ....but without success for the moment.
i'd appreciate your help in order to have a result as explained in the "result expected"
part of the file that I'm working with :
..........................
<policy name="Menu_Controls" class="User" displayName="$(string.Menu
<parentCategory ref="AdminApproved" />
<supportedOn ref="SUPPORTED_IE5" />
<elements>
<boolean id="MCSiMenu" valueName="{275E2FE0-7486-
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
<boolean id="PopupMenu_Object" valueName="{7823A620-9DD9-
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
<boolean id="Ikonic_Control" valueName="{F5131C24-E56D-
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
</elements>
</policy>
<policy name="Microsoft_Agent" class="User" displayName="$(string.Micr
<parentCategory ref="AdminApproved" />
<supportedOn ref="SUPPORTED_IE5" />
<elements>
<boolean id="Microsoft_Agent_Contro
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
</elements>
</policy>
..........................
my expected result :
..........................
name="Menu_Controls" key="Software\Policies\Mic
name="Microsoft_Agent" key="Software\Policies\Mic
......
..........................
I just noticed it stripped the \ out of the keys.... hmmmm....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks a lot for your help.
wonderful
toshi
wonderful
toshi
Open in new window
Here is the output I received:
# ./do
name="Menu_Controls" key="SoftwarePoliciesMicro
name="Microsoft_Agent" key="SoftwarePoliciesMicro