the last time I asked for help, it did not turn out to what is was looking for. Instead it was more talked about my non-well-formed XML. Therefore let me please try again to describe my problem:

The company of my client is using a huge XML file containing test departments including users of those test departments and more. An extract of a department called "Fighters" would look as following (copied 1:1 (but with different names and numbers)):

```
<config name="department" version="1.11">
     <xad version="1459" nocheckoutver="1701">
        <!-- ... -->
        <department name="/fighters" id="123879" group="channel" case="none" use="no">
            <replication region="4334">
                <options index_name="index.html" listing="0" sum="no" allowed="no" />
                <!-- ... -->
            </replication>   
            <target prefix="http" suffix=".net" />
            <!-- ... -->
            <user name="T:106603" />
            <user name="T:123879" />
            <user name="test" />
            <user name="ele::123456" />
            <user name="company-temp" />
            <user name="companymw2" />
            <user name="bird" />
            <user name="coding11" />
            <user name="plazamedia" />
            <allow go="123456=abcdefghijklmnopqrstuvwxyz" />    
            <!-- ... -->
        </department>
        <department name="/dancers" id="876543" group="floor" case="yes" use="no">
            <!-- ... -->
        </department>
    <!-- ... -->    
    </xad>
</config>    

```

Each test department is facing a unique id (here `123879`).

So I want to get the number of all users stored in an variable by just searching for the department-id (which is included in " "). How would the command look like *in detail*?

Note: The number of users in a department vary and the department-id is stored in a variable, let us call it `$dept`.

Many thanks in advance for a solution and your patience with me still fighting with `bash` programming. Please note: If the solution would be to run e.g. a Perl script I appreciate too in getting the related code for this.