File manipulation

Discussion in 'Cadence' started by PolyPusher, Apr 27, 2010.

  1. PolyPusher

    PolyPusher Guest

    Hi,

    I have a file with a list of blocks in a Unix dir...

    ga935a_01a
    ga935a_01b
    ga935a_01c
    ga935a_01d
    ga935a_01e
    ga935a_01f
    ga935b_01a
    ga935b_01b
    ga935b_01c
    ga935c_01a
    ga935c_01b
    ga935c_01c
    ga935c_01d
    ga935c_01e
    ga935c_01f
    ga935d_01a
    ga935d_01b
    ga935d_01c

    I want to turn this into a list for skill....

    ("ga935a_01a" "ga935a_01b" "ga935a_01c" "ga935a_01d" ..........
    "ga935d_01c")

    I know how to get out to unix and back, can I read this file in the
    format given and do what I want in Skill?

    Thank you for any help in advance,
    Eric
     
    PolyPusher, Apr 27, 2010
    #1
  2. PolyPusher

    Marcel Preda Guest

    Hi Eric,

    A procedure like:

    ;; put all the lines of a file into a list
    procedure( file2List(myFile)
    let( (pIn line retList)
    pIn = infile(myFile)
    while( gets(line pIn)
    ;; remove new line
    retList = cons(car(parseString(line "\n")) retList)
    )
    ;; elements were added into the opposite order
    retList = reverse(retList)
    )
    )


    And then just call:
    myList = file2List("my_input.txt")


    BR,
    Marcel
     
    Marcel Preda, Apr 28, 2010
    #2
  3. PolyPusher

    PolyPusher Guest

    That worked great!!

    Thank you,
    Eric
     
    PolyPusher, Apr 28, 2010
    #3
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.