sed with python
David Raleigh Arnold
darnold4 at cox.net
Thu Aug 28 07:30:22 EDT 2003
On Wed, 27 Aug 2003 19:26:36 +0200, U. N. Owen wrote:
>
> David Raleigh Arnold enlightened us with:
>> How do I use python as a wrapper for sed and/or gawk scripts?
>
> You don't. Python can do anything sed and awk can, and much, much more.
>
> Sybren
>
>
>
> That's true, but it may be useful to use existing code (and not bother
> rewriting in Python). You can use shell scripts, pipes, or if you want to
> use only python scripts, use
> os.system to call sed or awk.
> But if you write new functions, Python is enough, as Sybren says
Thanks. I didn't realize at first that Sybren had not read
the question before replying. I am using shell scripts, both
very simple ones that call sed and more elaborate ones that
extract fields from a database and do something with them.
Obviously, os.system does me no good at all. If windows
users had bash I would have no reason to use python to
call it.
Is there an equivalent to "tac" already written as a
function in python? Is there a matrix transposition
function that automagically adds fields to records so
that all records have the same number of fields, to
guard against data loss? Where are these found? DaveA
--
"We have learned the lessons of Viet Nam." --anon Spokesman
"Failure is not an option." --anon Spokesman
Can both be true? n Are both false? y Right answers get my vote.
D. Raleigh Arnold dra@ http://www.openguitar.com darnold4 at cox.net
More information about the Python-list
mailing list