473,385 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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


Jul 18 '05 #1
1 1377
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


Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: adams114 | last post by:
Ok, I'm trying to count the number of characters in a string. Once the count of character's reaches x I want to replace the rest of the string with an web site link. So here's what I've come up...
11
by: Martin Robins | last post by:
I am trying to parse a string that is similar in form to an OLEDB connection string using regular expressions; in principle it is working, but certain character combinations in the string being...
3
by: MJ | last post by:
For some reason the following script does not work in Netscape/Mozilla, but works fine in IE and Opera. It is supposed to check the syntax, make sure there is a valid TLD (yes, those are all of...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
15
by: linq936 | last post by:
Hi, I am reading book <<Expert C Programming>>, it has the following quiz, a //* //*/ b In C and C++ compiler what does the above code trun out? I think it is simple for C compiler, it is...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
11
by: tech | last post by:
Hi, I need a function to specify a match pattern including using wildcard characters as below to find chars in a std::string. The match pattern can contain the wildcard characters "*" and "?",...
9
by: Simon Woods | last post by:
Hi I'm new to Regular Expressions so ... I trying to work out regular expressions to parse the following (a + (b + c)) I really want to replace it with
6
by: James Arnold | last post by:
Hello, I am new to C and I am trying to write a few small applications to get some hands-on practise! I am trying to write a random string generator, based on a masked input. For example, given...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.