Help with parsing and matching a character

Discussion in 'Python' started by Fernando Armenta, Sep 19, 2003.

  1. Hello,



    I need some help matching a file to a path. This is my code:



    # I open an expect script to log into a linux system and get the
    version (6.5)



    MGMTP_IP = x.x.x.x



    p = os.popen('./remcmd.exp ' + MGMT_IP + ' ver ' + ' | grep Management >
    ' + ' build ')



    # I create a file call build with the version information



    I want to match the build information to an specific path /home/build90
    or /home/build91



    How can I do that in Python? Thanks for your help.



    -F
    Fernando Armenta, Sep 19, 2003
    #1
    1. Advertising

  2. Fernando Armenta

    wes weston Guest

    Fernando,
    A look at some strings in p would help; but.

    for line in p:
    if line.find("/home/build90") > -1:
    doyourthing()

    or I think this works:

    if "/home/build90" in line:
    doyourthing()


    wes



    Fernando Armenta wrote:

    > Hello,
    >
    >
    >
    > I need some help matching a file to a path. This is my code:
    >
    >
    >
    > # I open an expect script to log into a linux system and get the
    > version (6.5)
    >
    >
    >
    > MGMTP_IP = x.x.x.x
    >
    >
    >
    > p = os.popen('./remcmd.exp ' + MGMT_IP + ' ver ' + ' | grep Management >
    > ' + ' build ')
    >
    >
    >
    > # I create a file call build with the version information
    >
    >
    >
    > I want to match the build information to an specific path /home/build90
    > or /home/build91
    >
    >
    >
    > How can I do that in Python? Thanks for your help.
    >
    >
    >
    > -F
    >
    >
    >
    wes weston, Sep 20, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Brewer
    Replies:
    1
    Views:
    356
    Colin Brown
    Feb 23, 2004
  2. Eric @ Zomething
    Replies:
    0
    Views:
    355
    Eric @ Zomething
    Feb 23, 2004
  3. Uwe Lammers
    Replies:
    1
    Views:
    73
    Hermann Martinelli
    Aug 4, 2007
  4. Marc Bissonnette

    Pattern matching : not matching problem

    Marc Bissonnette, Jan 8, 2004, in forum: Perl Misc
    Replies:
    9
    Views:
    221
    Marc Bissonnette
    Jan 13, 2004
  5. Bobby Chamness
    Replies:
    2
    Views:
    216
    Xicheng Jia
    May 3, 2007
Loading...

Share This Page