This works...
Code:

$Wanted = 'Chairs:Tables:' ; sections we want
$Site = 'Columbus' ; Site we want to report on
$Search = '' ; Found section flag (Text)
$Grab = 0 ; Found site, but wrong line flag (Bool)


If Open(5,'Furniture.txt', 2) = 0

$Line = ReadLine(5)

While @ERROR = 0

If InStr($Wanted, Trim($Line)) And $Line <> '' ; found a section
$Search = Trim($Line)
EndIf

If $Search ; search is active
If InStr($Line, $Site) Or $Grab ; found a site
If Right($Line, 1) <> ',' ; is line complete?
$Tmp = Split($Line, ' ') ; split the data
$Value = Trim($Tmp[UBound($Tmp)]) ; get last field

$Search ',' $Value ? ; write it, probably to a file...

$Search = '' ; found it - reset search
$Grab = 0 ; reset Grab
Else
$Grab = 1 ; set grab
EndIF
EndIf
EndIf

$Line = ReadLine(5)
Loop
$ = Close(5)
EndIf



The key issue is that the data may be on a different line from the search criteria. You need to parse the file over multiple lines to collect what you want.

The file is read, searching for the SECTION: we want, allowing us to skip "Footstools:". When a section of interest is found, a FLAG is set (with the section name) indicating we should search for a detail record.

If the Section flag ($Search) is set, we start looking for the site. If we find the site or the Grab flag is true - but the last char is a "," - we know that the data is on a continuation line, so we set the GRAB flag and get the next line.

If Grab is true OR the site is in the line of data AND the last char is NOT a "," - the line is split on spaces, and the last field is captured.

Note where the FLAGs are set and cleared. The FLAG basically says we found one thing and need to locate the next. Once we find it, the flags should be cleared to prepare for the next search.

You'll need to clean the code just a bit, and modify the line that writes your CSV data. You might want to look at the CSV UDF I posted today.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D