473,385 Members | 1,912 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.

Parsing csh scripts with python

Is there a module out there that would be able to parse a csh script and
give me back a parse tree?

I need to be able to parse the script, modify some variable settings and
then write the script back out so that the only changes are the
variables I've modified (comments, ordering of statements, etc. must
remain the same).

I looked at shlex, but I don't think it will do what I need.
Any suggestions would be appreciated,
-Dave

--
Presenting:
mediocre nebula.

Mar 28 '06 #1
2 1449
On Tue, 28 Mar 2006, David Hirschfield wrote:
I need to be able to parse the script, modify some variable settings and
then write the script back out so that the only changes are the
variables I've modified (comments, ordering of statements, etc. must
remain the same).

I looked at shlex, but I don't think it will do what I need.


What about regular expressions?

--
.:[ dave benjamin -( ramen/sp00 )- http://spoomusic.com/ ]:.
"one man's constant is another man's variable" - alan perlis
Mar 28 '06 #2

Dave Benjamin wrote:
On Tue, 28 Mar 2006, David Hirschfield wrote:
I need to be able to parse the script, modify some variable settings and
then write the script back out so that the only changes are the
variables I've modified (comments, ordering of statements, etc. must
remain the same).

I looked at shlex, but I don't think it will do what I need.


What about regular expressions?


probably overkill here, but you might want to look into one of python's
templating libs. They make generating lots of "similar except for..."
code and markup relatively painless.

Mar 29 '06 #3

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

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
2
by: Boris Boutillier | last post by:
Hi all, I'm looking for parsing a Verilog file in my python module, is there already such a tool in python (a module in progress) to help instead of doing a duplicate job. And do you know of...
0
by: Benjamin Han | last post by:
A while ago I asked if anyone knows a module for parsing Received: headers in emails. Apparently my guess was wrong (that someone already wrote it in Python). I got an email pointing me to...
2
by: Peter Sprenger | last post by:
Hello, I hope somebody can help me with my problem. I am writing Zope python scripts that will do parsing on text for dynamic webpages: I am getting a text from an oracle database that contains...
4
by: djwallis81 | last post by:
I know there have been posts about this before but I am a python newbie and if someone can help I would appreciate it. I have a server running exim as its MTA. My users want to setup auto-reply...
2
by: Richard Shea | last post by:
Hi - I've got quite a number of PHP scripts which include many functions which call each other. I'm interested in having a means to determine which function gets called from which other...
4
by: Josef Wolf | last post by:
Hello! Is it possible to have CVS-style command line options with the optparse module? I could get as far as: import sys from optparse import OptionParser, OptionGroup parser =...
7
by: CG | last post by:
I am looking for a way to parse a simple log file to get the information in a format that I can use. I would like to use python, but I am just beginning to learn how to use it. I am not a...
3
by: Hilton Lima | last post by:
Hi there; I have the following problem. I am using one of the many javascript XML parsing scripts available around the Internet, but the parsing fails when it reach an XML child node that is...
7
by: Shankarjee Krishnamoorthi | last post by:
Hi, I am new to Python. I am trying to do the following inp = open(my_file,'r') for line in inp: # Perform some operations with line if condition something: # Start re reading for that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.