1) test.xml file
How can I extract hostname1.xxx.com(hostname) and key and env and then put it in one file ( a text file ) using perl scripts
Contents of xml file:
<httpsRoute hostname="abchostname1.xxx.com" port="443" environment="QA +"> <key>6924</key> </httpsRoute> <httpsRoute hostname="hostname3.xxx.com" port="7416" environment="CAT" +> <key>9990068</key> </httpsRoute>
Contents of text file should be:
Route #1 details:
Host=abchostname1.xxx.com
Environment=QA
key=6924
Route #2 details:
Host=hostname3.xxx.com
Environment=CAT
key=9990068
2) I'll have certficate.xml. Using perl how can i extract DN( subjectDN), CN, env and key and put them in a file using PERL Content of xml file:Contents of files should be:<certDet env="QA" subjectDN="/C=US/ST=NC/L=Raleigh/O=DotNet/OU=ETD +;D/CN=test1.xxxx.com"> <key>1234</key> </certDet> <certDet env="dev" subjectDN="/C=US/ST=NC/L=Charlotte/O=xxxxx/OU=W +AS/CN=dev1.xxx.com"> <key>27166</key> </certDet>
Entry1:
DN="/C=US/ST=NC/L=Raleigh/O=DotNet/OU=ET&D/CN=test1.xxxx.com"
CN=test1.xxxx.com
env=QA
key=1234
Entry2:DN="/C=US/ST=NC/L=Charlotte/O=xxxxx/OU=WAS/CN=dev1.xxx.com"
CN=dev1.xxx.com
env=QA
key=1234
In reply to extracting attribute values which might have multiple occurences from xml file by tinkuPerlMonk2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |