Help with parsing and matching a character

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fernando Armenta

    Help with parsing and matching a character

    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

    #2
    Re: Help with parsing and matching a character

    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:
    [color=blue]
    > 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
    >
    >
    >[/color]

    Comment

    Working...