<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta name="Generator" content="Zarafa WebAccess v7.0.7-34256">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>RE: Linux shell to python</title>
<style type="text/css">
body
{
font-family: Arial, Verdana, Sans-Serif ! important;
font-size: 12px;
padding: 5px 5px 5px 5px;
margin: 0px;
border-style: none;
background-color: #ffffff;
}
p, ul, li
{
margin-top: 0px;
margin-bottom: 0px;
}
</style>
</head>
<body>
<p>You can do this with one subprocess.Popen and some python commands.</p><p>The alternative is to pipe some subprocess.Popen commands together.</p><p>Or for the quick way out (but I think you better stick with bash scripting then): http://pypi.python.org/pypi/sarge/</p><p>Don't know about it's stability/ubs/etc, never used it.<br /> </p><blockquote style="border-left: 2px solid #325FBA; padding-left: 5px;margin-left:5px;">-----Original message-----<br /><strong>From:</strong> Vikas Kumar Choudhary <vikas.choudhary@yahoo.co.in><br /><strong>Sent:</strong> Mon 30-07-2012 09:34<br /><strong>Subject:</strong> Linux shell to python<br /><strong>To:</strong> python-list@python.org; <br /><style type="text/css">body { font-family: monospace; }</style> <div><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Dear friends,</div><div><br /></div><div>I just joined the group.</div><div>I was trying porting from bash shell to python.</div><div><br /> </div><div>let me know if someone has tried to implement (grep and PIPE) shell commands in python `lspci | grep Q | grep "$isp_str1" | grep "$isp_str2" | cut -c1-7'</div><div> </div><div>I tried to use python subprocess and OS.Popen modules.<br /><b><i><br />Thanks & Regard's</i></b><img alt="" src="http://us.i1.yimg.com/us.yimg.com/i/mesg/tsmileys2/01.gif" /><br /><br /><b>Vikas Kumar Choudhary <br /><br /><br /></b><b><span style="font-size:10pt;"><font style="color:rgb(128, 255, 0);"><span style="background-color:rgb(127, 63, 0);">(Yahoo,MSN-Hotmail,Skype) Messenger = vikas.choudhary</span><span style="background-color:rgb(127, 63, 0);"><br />Please Add Me in Your Messenger List for Better Communication</span></font></span></b></div> <div><span style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); "><span style="color: rgb(51, 153, 51); font-family: Webdings; font-size: 18pt; ">P</span><span style="color:rgb(51, 153, 51);font-size:11pt;"> </span><b><span style="color:rgb(51, 153, 51);font-size:9pt;">Please consider the environment before printing this e-mail</span></b></span><b><span style="font-size:10pt;"><font style="color:rgb(128, 255, 0);" size="3"><span style="background-color:rgb(127, 63, 0);"><br /></span><font size="2">Do not print this email unless it is absolutely necessary. <br />Save papers, Save tree.</font><br /></font>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br /></span></b>Note: This e-mail is confidential and may also be privileged, this is for the intended recipients only. If you are not the intended recipient, please delete the message and notify me immediately; you should not copy or use it for any purpose, nor disclose its contents to any other person.<br /><br />Notice: All email and instant messages (including attachments) sent to or from This E-mail id , may be retained, monitored and/or reviewed, or authorized law enforcement personnel, without further notice or consent.<br />----------------------------------------------------------------------------------------------------------------------<br /> </div></div></div><pre>
-- <br /> http://mail.python.org/mailman/listinfo/python-list<br /> </pre> </blockquote>
</body>
</html>