Python really on the command lineΒΆ

Tags: python

Take a look at this tiny program by Graham Fawcett. This pyline program is something you can use when piping grep, tail, less, etcetera together. Just some ideas:

 cat test.log|pyline "line.upper()"
 cat test.log|pyline "line.replace('Init', 'raargh')"
 cat test.log|pyline "words[0].upper()"|less

I keep forgetting the sed syntax for changing strings, pyline lets me use some python knowledge in doing stuff like this.

Found it at the daily python . Warning: you might need to do a dos-to-unix line-ending conversion.

blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):