06-23-2014 09:38 AM
I have a .txt file (See attached) I am using the spreadsheet to array function to extract the data that I need. I am trying to extract the Inspection Finished Time and the double number beside that seperately but I am having trouble with the delimiter. The .txt file will not always be this size but the 1st and last line will be the same
Solved! Go to Solution.
06-23-2014 09:45 AM - edited 06-23-2014 09:46 AM
@PauldePaor wrote:
I have a .txt file (See attached) I am using the spreadsheet to array function to extract the data that I need. I am trying to extract the Inspection Finished Time and the double number beside that seperately but I am having trouble with the delimiter. The .txt file will not always be this size but the 1st and last line will be the same
I'm guessing you are trying to use a blank space as the delimiter, correct? Why not just use a more distinguishable delimiter? A common one is CSV (comma seperated value). If you want one more easily human-readable text file, try using a tab character. Etc. This would at least remove any delimiting issues.
Would you mind posting the code you have tried so far? That way we can give you some advice on how to tweak your approach to meet the desired solution.
06-23-2014 09:47 AM
I tried using the Inspection Finished as my dilimiter but it did not work. Please see mt code so far attached
06-23-2014 09:50 AM - edited 06-23-2014 09:55 AM
@PauldePaor wrote:
I have a .txt file (See attached) I am using the spreadsheet to array function to extract the data that I need. I am trying to extract the Inspection Finished Time and the double number beside that seperately but I am having trouble with the delimiter. The .txt file will not always be this size but the 1st and last line will be the same
I think i would use the "Read from Text File" and select "Read Lines" from the right-click menu instead. Then parse the info out the way you want to.
[edit]
Sorry, my post was made after you posted your snippet. It seems the format is rigid and you don't have to rely on delimiters.
[/edit]
06-23-2014 09:53 AM - edited 06-23-2014 09:54 AM
@PauldePaor wrote:
I tried using the Inspection Finished as my dilimiter but it did not work. Please see mt code so far attached
Ah I see. I now understand why you are having troubles.
You have misunderstood the term "delimiter". In this case, a "delimiter" is the character used to seperate each and every unit of your file. For example, this is your file using a comma delimiter:
12:19:26,Inspection Started (View)
12:20:29,85.80 m,Mode Changed to Inspect
12:20:33,89.96 m,Inspection Finished
Notice how every element that I want seperated is delimited with a comma between them. What you are telling this function is "every item in this file is seperated by the string 'Inspection Finished'". In other words, instead of using the comma (as in the above example), you are using "Inspection Finished". This will be very chaotic and would look something like this:
12:19:26Inspection FinishedInspection Started (View)
12:20:29Inspection Finished85.80 mInspection FinishedMode Changed to Inspect
12:20:33Inspection Finished9.96 m
You are trying to use the delimit as a "search". When the delimiter is really a seperation character that partitions the file into smaller segments.
06-23-2014 09:58 AM
How can I now only get the time and double by inspection finished?
06-23-2014 10:02 AM
@PauldePaor wrote:
How can I now only get the time and double by inspection finished?
You know where each piece of data starts and ends in the string. That's one way you could do it.
06-23-2014 10:07 AM - edited 06-23-2014 10:09 AM
@PauldePaor wrote:
How can I now only get the time and double by inspection finished?
There are a few ways to approach this depending on what exactly your end goal is.
Do you want them both in one string? "12:20:33 89.96 m"
Do you want them both as seperate strings (also perhaps in an array)? "12:20:33" "89.96 m"
Do you want the time as a string and the value as a number? "12:20:33" 89.96
Etc.
EDIT:
Also do you ideally want to specify a line number and extract this info? Or do you want to parse every single line after the top "title" style line? These are things that can be considered as well.
06-23-2014 10:11 AM
I would like them in an array both of them can be strings it does not matter for my application. The text I want will always be on the last line of the file
06-23-2014 10:14 AM