请问一个关于文本读写的疑难有关问题

请教一个关于文本读写的疑难问题
有一个文本文件,比如是: a.txt,它的内容如下:

===========正文内容如下:===================
[13:20:21.482] onb=115[3921] readqa:
ACTION=ser          ;动作标识 ser
...
...(其他无关内容省略)
...

[13:20:21.536] onb=115[3921] ansqa:
ACTION=ser
...
...(其他无关内容省略)
...


[19:20:21.482] onb=103[1089] readqa:
ACTION=acc        ;动作标识 acc
...
...(其他无关内容省略)
...

[19:20:21.536] onb=103[1089] ansqa:
ACTION=acc
...
...(其他无关内容省略)
...
===========正文内容结束:==================

正文内容说明:记录了不同的动作,如 acc 或ser ,动作开始的标识是readqa:  ,动作结束的标识是 ansqa:
一个动作的onb的值是相同的(即同一个onb值的序号的readqa,ansqa是一个动作的开始和结束)


现在我想读取此文本文件的几个内容分别赋值给:
fstime1 =13:20:21   ,数据来自 [13:20:21.482] 里面的   
fstime2 = 482          ,数据来自 [13:20:21.482] 里面的   
onbnb  =115[3921]  ,数据来自 onb=115[3921] 
typenb =readqa       ,(每行末尾的 readqa 或者是ansqa)

usetime3 =54           ,数据来自ansqa行的fstime2 - readqa行的fstime2 ,如 54=(536-482)

(也就是说,我想统计出一个动作(比如ser 或 acc)的耗时,利用ansqa里的fstime2 - readqa里的fstime2 ,得出的就是这个动作的耗时 usetime3= ansqa.fstime2 - readqa.fstime2 )


现在就有2个疑难问题想请教一下大家:
1、如何取到文本文件里的这些值 ?
2、如果一个目录下,有多个子目录,每个子目录下都有这种类型的文本文件,该如何遍历取出这些值写到数据库里?

谢谢各位大虾的指点。

------解决方案--------------------

……
FFileList.Clear;
//遍历目录获取文件列表
procedure FileSearch(PathName:string);
var
  F : TSearchRec;
  Found : Boolean;
begin
  
  PathName := IncludeTrailingPathDelimiter(PathName);

  ChDir(PathName);
  Found := (FindFirst('*.txt', faAnyFile, F) = 0);
  while Found do begin
    if (F.Name = '.') or (F.Name = '..') then begin
      Found := (FindNext(F) = 0);
      Continue;
    end;
    //递归子目录
    if (F.Attr and faDirectory)>0 then begin
      Application.ProcessMessages;
      FileSearch(F.Name);
    end;

      FFileList.Add(PathName + F.Name);

    Found := (FindNext(F) = 0);
  end;
  FindClose(F);
  ChDir('..\');
end;

//遍历文件列表获取数值
procedure FileRaad(aFileName : string);
var
  tmpFile : TStringList;
  I,tmpLen : Integer;
  tmpLine : string;
begin  
  if FileExists(aFileName) then begin
     tmpFile := TStringList.Create;
     try
       tmpFile.loadfromfile(aFileName);
       for I := 0 to tmpFile.Count - 1 do begin 
          tmpLine  := tmpFile[I];
          tmpLen := length(tmpLine );
          if AnsiEndsText('readqa',tmpLine) then begin //动作开始
             //截取字符串获取开始时间
          end;
          if AnsiEndsText('ansqa',tmpLine) then begin //动作结束
             //截取字符串获取结束时间
          end;
         ……//变量赋值或数据存储
       end;
     finally
        freeandnil(tmpFile );
     end;
  end;
end;

------解决方案--------------------
数据提取出来了, 其他应用规则你lz自行处理.(xe测试通过)

uses RegularExpressions;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
const
  pattern  = '(\[\d{2}:\d{2}:\d{2}.\d{3}\] onb=\d{3}\[\d{4}\]) (\w{6}
------解决方案--------------------
\w{5}
------解决方案--------------------
)';
var
  txt,url: string;
  match: TMatch;
  sLst : TStringList;
  i: Integer;
begin
  Memo1.Clear;

  sLst := TStringList.create;
  try
    sLst.LoadFromFile('c:\test.txt');

    for match in TRegEx.Matches(sLst.Text, pattern) do