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.
My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.
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):