Python really on the command lineΒΆ
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.