I am trying to look in a file, for a string that varies from machine to machine - it has 3 to 4 different variations.
They look similiar to the Following:
pc###
pccrt### (ex. pccrt105)
pccart###
Here is what I came up with
matches (regex "pc
c\d
ra\d
tr\d
t\d
\d
\d
") of lines of file “c:\thefile.cfg”
What’s odd, is that when I run the QnA on Windows7 it returns the information fine. But when I try this in XP I don’t even get an Answer response from the debugger.
Also, in the file itself, it looks something like this “kjasdhfiueGetPageIpccrt105asdjfkh”
I think I am having other issues. It doesn’t work until I go into the file and save it - It’s not a standard .txt file. Not sure if it is a permissions issue or a file association issue. Or the relevance has issues with non standard .txt…
Edit: When I save it, I see it adds my user account to the Security tab. Once it is like that, I can pull the information properly.
So now I have to figure out if there is a way to get around the permissions of the file. Or I am thinking maybe if I make a copy of the file through a bigfix relevance, and the file created will have the acceptable permissions to let me pull the info I want.
I still haven’t been able to figure this out. I think I have all the proper permissions set at this point. I am wondering if it is an issue in the way the document is written.
It is not your typical .txt file, it’s probably more of a binary data file that just has some legible text in it that I want. I am wondering if when I am opening it up and saving it, its converting it to a more legible format behind the scenes, and then its able to read by the relevance parse.
I know I could parse out the entire binary file with a Java script and save it as a .txt file and then maybe run the big fix relevance on the created .txt file, but I would like to stick strictly doing this through Big Fix. Any suggestions on dealing with binary data files like this?
Converting it to text using some external tool is a possibility. If the file is very “regular” – that is, it has a strict internal format – then you may be able to use the “byte” inspector described
I hate to bump this post but I wanted to post my solution to this problem. I ended up going with this:
if (exists file “c:\Program Files\McKesson\PCView32\pcview.cfg”) then (concatenation of characters (bytes (2000;2001;2002;2003;2004;2005;2006;2007;2008) of (file “C:\program files\mckesson\pcview32\pcview.cfg”))) else “Application not installed”
In some cases this got me some trailing character that I didn’t want, and the application couldn’t be running to get the results. The report(.csv file) also contains a lot of data that I don’t want, such as the “Application not installed” workstations.
I’ve already wrote a Java application that just parses the data I want and saves it back as a .csv file. (I chose Java because I am enrolled in a course for it).