Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cmd.exe /C "C:\Program Files\IBM\InfoSphere Data Replication\Management Console\bin\chcclp.exe" -f c:\CDC_Check.txt > C:\temp\file.log
- $fileContent = Get-Content -Path "C:\temp\file.log"
- $i=0
- $fileContent | %{
- $i++
- if($_ | Select-String -Pattern "SUBSCRIPTION STATE" -CaseSensitive){
- $headerIndex = $i
- }
- }
- $headerIndex += 2
- #start of data to capture
- $hashObj= @{}
- for ($x = $headerIndex; $fileContent[$x].Substring(0,1) -ne " " ;$x++){
- $hashObj.Add("$($fileContent[$x].Substring(0,19).Trim(' '))","$($fileContent[$x].Substring(20,19).Trim(' '))")
- }
- #converts your hashtable to json object
- $jsonObj = $hashObj | convertto-json
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement