Probably I’m doing this in wrong way. Need some feedback.
Assume there is a text file called “inv.txt”
The file contains several lines; each line has three values separated by space.
The second value is our search input. (The capital letter):
Now we want to search the entire file for specific value.
Find all lines where second value is "B" and print out the first and third value for those found lines.
Code:
$file = “inv.txt”
$input = “B”
$ = Open (1,$file)
$Line = ReadLine (1)
If InStr($Line,$input)
$LFound = Split($Line," ")
For Each $item in $LFound
If 0 <= Ubound($LFound)
$First = $LFound[0]
If 0 <= Ubound($LFound)
$second = $LFound[1]
If 0 <= Ubound($LFound)
$third = $LFound[2]
Next
$First ?
$second ?
$third ?
Above will work if the input value is “B”.
But in case we search for “E”, then we have problem.
It seems that code will only read the first line of the file.
The other problem is when the input value is located in more then one line.
In this case the letter “E” is located in two lines.
How do I make it work in a clever way?
_________________________
I will always look out from behind these eyes...