searching text files...

Discussion in 'AutoCAD' started by avw_410, Jan 4, 2005.

  1. avw_410

    avw_410 Guest

    I need some help here... I have a text file that is like this:

    1009
    jobname
    location
    arch
    contractor

    1010
    jobname
    location
    arch
    contractor

    etc...

    I want to search this text file in lisp to create a list of the
    information... is it possible...

    TIA
    aw
     
    avw_410, Jan 4, 2005
    #1
  2. avw_410

    mattis Guest

    Try this out. Change the text file path in this code to where ever the file is located.

    (defun txtlist (/ txtfile eof mytextlist line)
    (setq txtfile (open "c:\\mytext.txt" "r"))
    (setq eof 1
    mytextlist nil)
    (while (= eof 1)
    (setq line (read-line txtfile))
    (if line
    (progn
    (setq mytextlist (append (list line) mytextlist))
    )
    (setq eof nil)
    )
    )
    (close txtfile)
    (setq mytextlist (reverse mytextlist))
    )
     
    mattis, Jan 4, 2005
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.