Team,
We need help in getting the customer count of multiple xml file present in a directory.
My xml structure is like below :
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers xmlns="Demandware - Commerce Platform | eCommerce Software">
<customer customer-no="2253998836943556"><credentials><login>susan@nealfam.com</login><password encrypted="true" encryptionScheme="scrypt">$s0$b0401$jzFfnnT2Z8SZiiJ+hT1nfA==$GdFi0r5ATbTjzRc2KdqYpxyQBqBJVgCl/E0qYdqHRws=</password><enabled-flag>true</enabled-flag><password-question></password-question><password-answer></password-answer></credentials><profile><first-name>Susan</first-name><second-name></second-name><last-name>Neal</last-name><email>susan@nealfam.com</email><phone-home></phone-home><phone-business></phone-business><phone-mobile></phone-mobile><fax></fax><creation-date>2000-04-20T02:18:36.000Z</creation-date><preferred-locale></preferred-locale><custom-attributes><custom-attribute attribute-id="legacyTransition">notcomplete</custom-attribute><custom-attribute attribute-id="legacyAccount">true</custom-attribute><custom-attribute attribute-id="rewardsMemberFlag">false</custom-attribute><custom-attribute attribute-id="rewardsID"></custom-attribute><custom-attribute attribute-id="rewardsEmail">susan@nealfam.com</custom-attribute><custom-attribute attribute-id="promoPref">false</custom-attribute><custom-attribute attribute-id="rewardsPref">false</custom-attribute><custom-attribute attribute-id="legacyID">2756</custom-attribute><custom-attribute attribute-id="hasBrandedCard">false</custom-attribute><custom-attribute attribute-id="hasPaypal"></custom-attribute></custom-attributes></profile><addresses><address address-id="56297194367043129" preferred="false"><first-name>Susan</first-name><second-name></second-name><last-name>Neal</last-name><address1>Gymboree</address1><address2>500 Howard St</address2><postbox></postbox><city>San Francisco</city><postal-code>94105</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>4152787561</phone><custom-attributes><custom-attribute attribute-id="addressType">BIL</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194380317767" preferred="true"><first-name>Susan</first-name><second-name></second-name><last-name>Neal</last-name><address1>2745 Lake St</address1><address2></address2><postbox></postbox><city>San Francisco</city><postal-code>94121-1047</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>4157501501</phone><custom-attributes><custom-attribute attribute-id="addressType">BIL,SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194365826730" preferred="false"><first-name>Susan</first-name><second-name></second-name><last-name>Neal</last-name><address1>2745 Lake St</address1><address2></address2><postbox></postbox><city>San Francisco</city><postal-code>94121</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>650-696-7561</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194365845003" preferred="false"><first-name>Zachary</first-name><second-name></second-name><last-name>Neal</last-name><address1>19 Milldam Road</address1><address2></address2><postbox></postbox><city>Acton</city><postal-code>01720</postal-code><state-code>MA</state-code><country-code>US</country-code><phone>9782632093</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194365899569" preferred="false"><first-name>Christian Oliver and Xander</first-name><second-name></second-name><last-name>Picot</last-name><address1>19304 Overleaf Lane</address1><address2></address2><postbox></postbox><city>Davidson</city><postal-code>28036</postal-code><state-code>NC</state-code><country-code>US</country-code><phone>631-283-7027</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194365923826" preferred="false"><first-name>Mr. and Mrs. Seth</first-name><second-name></second-name><last-name>Bain</last-name><address1>Small Pond Studios</address1><address2>254 Ritch St</address2><postbox></postbox><city>San Francisco</city><postal-code>94107</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>415-498-2105</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194366021537" preferred="false"><first-name>Carter</first-name><second-name></second-name><last-name>Croke</last-name><address1>5692 South Nome Street</address1><address2></address2><postbox></postbox><city>Englewood</city><postal-code>80111</postal-code><state-code>CO</state-code><country-code>US</country-code><phone>650-696-7561</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194366053342" preferred="false"><first-name>Mr. and Mrs. Ward</first-name><second-name></second-name><last-name>Supplee</last-name><address1>301 22nd Avenue</address1><address2></address2><postbox></postbox><city>San Mateo</city><postal-code>94403</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>650-799-0032</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194366053343" preferred="false"><first-name>Beth</first-name><second-name></second-name><last-name>sususus</last-name><address1>123 Lakdfj</address1><address2></address2><postbox></postbox><city>San Francisco</city><postal-code>94121</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>650-696-7561</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194366142219" preferred="false"><first-name>sdddds</first-name><second-name></second-name><last-name>ssss</last-name><address1>dsdsds</address1><address2></address2><postbox></postbox><city>SAN FRANCISCO</city><postal-code>94121</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>650-696-8888</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address></addresses></customer>
<customer customer-no="2253998836943557"><credentials><login>susan1@nealfam.com</login><password encrypted="true" encryptionScheme="scrypt">$s0$b0401$jzFfnnT2Z8SZiiJ+hT1nfA==$GdFi0r5ATbTjzRc2KdqYpxyQBqBJVgCl/E0qYdqHRws=</password><enabled-flag>true</enabled-flag><password-question></password-question><password-answer></password-answer></credentials><profile><first-name>Susan</first-name><second-name></second-name><last-name>Neal</last-name><email>susan@nealfam.com</email><phone-home></phone-home><phone-business></phone-business><phone-mobile></phone-mobile><fax></fax><creation-date>2000-04-20T02:18:36.000Z</creation-date><preferred-locale></preferred-locale><custom-attributes><custom-attribute attribute-id="legacyTransition">notcomplete</custom-attribute><custom-attribute attribute-id="legacyAccount">true</custom-attribute><custom-attribute attribute-id="rewardsMemberFlag">false</custom-attribute><custom-attribute attribute-id="rewardsID"></custom-attribute><custom-attribute attribute-id="rewardsEmail">susan@nealfam.com</custom-attribute><custom-attribute attribute-id="promoPref">false</custom-attribute><custom-attribute attribute-id="rewardsPref">false</custom-attribute><custom-attribute attribute-id="legacyID">2756</custom-attribute><custom-attribute attribute-id="hasBrandedCard">false</custom-attribute><custom-attribute attribute-id="hasPaypal"></custom-attribute></custom-attributes></profile><addresses><address address-id="56297194367043129" preferred="false"><first-name>Susan</first-name><second-name></second-name><last-name>Neal</last-name><address1>Gymboree</address1><address2>500 Howard St</address2><postbox></postbox><city>San Francisco</city><postal-code>94105</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>4152787561</phone><custom-attributes><custom-attribute attribute-id="addressType">BIL</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194380317767" preferred="true"><first-name>Susan</first-name><second-name></second-name><last-name>Neal</last-name><address1>2745 Lake St</address1><address2></address2><postbox></postbox><city>San Francisco</city><postal-code>94121-1047</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>4157501501</phone><custom-attributes><custom-attribute attribute-id="addressType">BIL,SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194365826730" preferred="false"><first-name>Susan</first-name><second-name></second-name><last-name>Neal</last-name><address1>2745 Lake St</address1><address2></address2><postbox></postbox><city>San Francisco</city><postal-code>94121</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>650-696-7561</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194365845003" preferred="false"><first-name>Zachary</first-name><second-name></second-name><last-name>Neal</last-name><address1>19 Milldam Road</address1><address2></address2><postbox></postbox><city>Acton</city><postal-code>01720</postal-code><state-code>MA</state-code><country-code>US</country-code><phone>9782632093</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194365899569" preferred="false"><first-name>Christian Oliver and Xander</first-name><second-name></second-name><last-name>Picot</last-name><address1>19304 Overleaf Lane</address1><address2></address2><postbox></postbox><city>Davidson</city><postal-code>28036</postal-code><state-code>NC</state-code><country-code>US</country-code><phone>631-283-7027</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194365923826" preferred="false"><first-name>Mr. and Mrs. Seth</first-name><second-name></second-name><last-name>Bain</last-name><address1>Small Pond Studios</address1><address2>254 Ritch St</address2><postbox></postbox><city>San Francisco</city><postal-code>94107</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>415-498-2105</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194366021537" preferred="false"><first-name>Carter</first-name><second-name></second-name><last-name>Croke</last-name><address1>5692 South Nome Street</address1><address2></address2><postbox></postbox><city>Englewood</city><postal-code>80111</postal-code><state-code>CO</state-code><country-code>US</country-code><phone>650-696-7561</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194366053342" preferred="false"><first-name>Mr. and Mrs. Ward</first-name><second-name></second-name><last-name>Supplee</last-name><address1>301 22nd Avenue</address1><address2></address2><postbox></postbox><city>San Mateo</city><postal-code>94403</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>650-799-0032</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194366053343" preferred="false"><first-name>Beth</first-name><second-name></second-name><last-name>sususus</last-name><address1>123 Lakdfj</address1><address2></address2><postbox></postbox><city>San Francisco</city><postal-code>94121</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>650-696-7561</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address><address address-id="56297194366142219" preferred="false"><first-name>sdddds</first-name><second-name></second-name><last-name>ssss</last-name><address1>dsdsds</address1><address2></address2><postbox></postbox><city>SAN FRANCISCO</city><postal-code>94121</postal-code><state-code>CA</state-code><country-code>US</country-code><phone>650-696-8888</phone><custom-attributes><custom-attribute attribute-id="addressType">SHP</custom-attribute><custom-attribute attribute-id="isLegacy">true</custom-attribute></custom-attributes></address></addresses></customer>
</customers>
From the above sample xml ,we need to take the total count of customer no from the file. So we need to consider the total no of 'customer-no' present in that file.
In a directory ,many similar xml files will be present.so we need to provide the total ''customer-no' present in all the files.
Can anyone kindly help me to getting the count of total customer from the all the files in a directory through unix scripting. As I'm new to scripting ,any help here will be appreciated.