;; | ---------------------------------------------------------------------------- ;; | MI_GetLinesWith ;; | ---------------------------------------------------------------------------- ;; | Function : Returns lines in a text file which contain a given string pattern ;; | Argument : 'fn' - ASCII file name ;; | 'Mode' - Mode of search, can be "Partial" or "Exact" ;; | 'SrchStr' - String to search for ;; | Returns : A list of strings matching the given search pattern ;; | Updated : September 10, 2002 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun MI_GetLinesWith ( fn Mode SrchStr / Lst Lst1 Found Str ) (setq Lst (TX_File2Lst fn) Lst1 '() ) (if Lst (progn (setq Lst1 '()) (foreach Str Lst (setq Found nil) (cond ((= Mode "Exact") (if (= Str SrchStr) (setq Found T) ) ) ((= Mode "Partial") (if (wcmatch Str (strcat "*" SrchStr "*")) (setq Found T) ) ) ) (if Found (setq Lst1 (cons Str Lst1)) ) ) (setq Lst1 (reverse Lst1)) )) Lst1 )