This is a straight text file. I am writing the script using Powershell since I am a bit more familiar working with text files in PS. But I can do this in vbscript or python if it would be easier.
So this file contains a number of lines in it and there are many tabbed areas. I was able to remove the tab spacing from the file to clean it up a but. I was also successful at pulling out the lines that matched a specific string. But then the wrench happend, there are a large number of lines that have carriage returns within the string contents. here is my goals...
String to match is "AUTHORITY-CHECK OBJECT"
1) Remove Empty Tab Spacing - done
(gc FILENAME) -replace ' {2,}','' | sc NEWFILENAME
I am using variables where you see filenames since the paths are long and I will eventually replace with a user input box of sorts.
2) Remove carriage returns after "AUTHORITY-CHECK " if the next line begins with OBJECT or there is nothing after AUTHORITY-CHECK
3) Write to new clean file - done
4) Select lines from the clean file that match the string "AUTHORITY-CHECK OBJECT" and write to dump/final file - done
Select-String NEWFILENAME -pattern 'AUTHORITY-CHECK OBJECT' | foreach {$_.Line} | out-file -Encoding ASCII NEWFINALFILE
So yes the carriage returns are mucking up my results. the information will be used to show our devs their fixes to the app are not working. So I want to make sure all lines are included. First results before I noticed the carriage returns showed 192 lines. Going back there about 326 total lines containing "AUTHORITY-CHECK"
Any assistance would be appreciated!
Oh and my programming skills suck
