LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to check the content in a text file line

hi all,
 
i had the following problem:
 
  • There is a text file with multiple lines of data in it
  • The data comprises of characters, numbers and symbols
  • In this file, any line can be commented (till the end) by using symbol ';'(semi-colon)
  • Now i have to find the number of occurences of a symbol '$' in this data, such that
  • it should not exist in a commented line
  • One more limitation is that ';' (semi-colon) could occur at any position in a line, i.e., if this occured in the middle of the line, then all the following data in the line is taken to be as commented one and we have to skip it and move to next line.

Plz do help.

Regards,

santosh

Regards,
santosh
0 Kudos
Message 1 of 12
(4,197 Views)
Santosh
 
Can you post an example of the text file?
 
thanks
 
David
0 Kudos
Message 2 of 12
(4,191 Views)
Hi santosh,
just a guess this is what you need.




Greets, Dave

Message Edited by daveTW on 09-15-2006 09:59 AM

Greets, Dave
Download All
Message 3 of 12
(4,187 Views)

hi david,

 

i think the following attachemnt will be sufficient:

 

i have to calculate the number of '$' in the file, excluding those which are preceded by ';' in the same line

Regards,
santosh
0 Kudos
Message 4 of 12
(4,178 Views)

Thanks Santosh

You should try coding up Dave's suggested solution and let Dave know that it works for you and provide him with lots of stars Smiley Wink

cheers

David

0 Kudos
Message 5 of 12
(4,173 Views)

hi dave,

Thanks for ur reply,

the code which u gave works perfectly at all the conditions given in the problem,

except that when this semi-colon ';' comes in the middle of the line,

then we have to skip the data following it (semi-colon) in the line and count the number of occurences of '$' precedding ';' ,

i think here we face a problem.

Plz do reply.

Regards,

santosh.

Regards,
santosh
0 Kudos
Message 6 of 12
(4,171 Views)
Try this ...
 
 
David

Message Edited by David Crawford on 09-15-2006 10:24 AM

Message 7 of 12
(4,159 Views)
Yes, I found a (for me) very common mistake, there must the "<>0" be replaced by a ">=0", then it works. David Cramers solution is very good, when you expect only one $ in a line.



Greets, the other Dave

Message Edited by daveTW on 09-15-2006 11:56 AM

Greets, Dave
Message 8 of 12
(4,148 Views)

hi dave,

 

could u provide the sample example that is compatible with version 7.0,

i could not able to open the code which u sent earlier.

Regards,

santosh

Regards,
santosh
0 Kudos
Message 9 of 12
(4,137 Views)
Sorry,
I have only 8.0 on this computer, so I can only make 7.1- VIs. Perhaps it helps...
Greets, dave
Greets, Dave
Message 10 of 12
(4,132 Views)