25112
asked on
can powershell search xml?
can you suggest syntax for powershell to search for a particular phrase inside an xml file ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There are various ways you can work with .XML files. If you provide a sample and say exactly what you are trying to do more specific guidance can be given.
ASKER
the file has extenstion .dtsconfig
the code is
---
<?xml version="1.0"?><DTSConfigu ration><DT SConfigura tionHeadin g><DTSConf igurationF ileInfo GeneratedBy="SBret-PC\SBre t" GeneratedFromPackageName=" DownloadHe aderInfo" GeneratedFromPackageID="{7 6F224FA-D4 D1-4CAA-8F A8-9YFDCC9 46EAB}" GeneratedDate="8/12/2014 3:13:03 PM"/></DTSConfigurationHea ding><Conf iguration ConfiguredType="Property" Path="\Package.Connections [Dashboard ].Properti es[Connect ionString] " ValueType="String"><Config uredValue> Data Source=POS16\POSBoard;Init ial Catalog=AMP;Provider=SQLNC LI11.1;Int egrated Security=SSPI;Auto Translate=False;Applicatio n Name=SSIS-DownloadHeaderIn fo;</Confi guredValue ></Configu ration></D TSConfigur ation>
---
can you please copy the above and then save in a text as DownloadHeaderInfo.dtsconf ig .. this is what we need to search inside of.. for example, we may search for a string of 'POS16'..
thanks
the code is
---
<?xml version="1.0"?><DTSConfigu
---
can you please copy the above and then save in a text as DownloadHeaderInfo.dtsconf
thanks
OK, so you're seaching for the string "POS16". Does it have to be in a certain field or anywhere in the file? What do you need returned if it is found?
ASKER
anywhere in the file.
we will searching so many dtsconfig files.. so just return a list of the files that contain this string, please?
we will searching so many dtsconfig files.. so just return a list of the files that contain this string, please?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you very much- it worked.