I have a batch script which will print the entire line of search string into a text file.
for %%i in (configure.txt) do (
FINDSTR /C:"Widget Name=" %%i >> output.txt
)
Here is how my Configure.txt file will look like:
<Widget Name="example_1_new" Type="IFC"/>
<Property Name="exmaple_2_old"/>
<Content>
<Widget Name="example_3_new"/>
<Widget Name="example_4_old"/>
<Widget Name="exmaple_1_new"/>
</Content>
I want to print the next word(example1) after the "Widget Name="(Search String) and also find the duplicates of the word(Example1) and print its count next to it,So that my output should be like:
example_1_new 2
Can someone let me know how to do this? Please note the configure.txt has around 1000 lines of data like above. I just gave an example.
unix
style programs by using awk. Here is very good reference, step by step: grymoire.com/Unix/Awk.html