In a UTF-16LE log file, I have lines like this:
[128 characters]APP_NAME=Samsung Magician&APP_KEY=[additional characters]&APP_FLAG=[single digit]
I want the APP_NAME (e.g., Samsung Magician) from each line where APP_FLAG=0. I can identify those lines thus:
FIND "APP_FLAG=0" "C:\[directory]\logfile.log" > D:\Progs1.txt
The next step is less clear. I'm having trouble extracting the desired text from the middle of those lines in Progs1.txt. It's easy in Excel, but this time I'd like to learn how to automate the process.
I believe the next step is to discard the first 128 + 9 characters from each line in Progs1.txt. Ideally, I wouldn't rely on the assumption that there will always be exactly 128 leading characters. Instead, I would use APP_NAME as the delim in a FOR loop. But it seems multiple characters are not permitted for that purpose.
I'm not yet at the point of trying to figure out the final step, discarding the text beginning with &APP_KEY, so as to leave only the app name as final output. If I could assume a constant number of underscores in each line, maybe I could use something like the Split String code. But I don't know if lines vary in the number of underscores used.
The question here is just, what command is best to produce a Progs2.txt output file in which each line begins with an app name (e.g., Samsung Magician)?
No comments:
Post a Comment