do a sed / awk filter with python tools (at least as fast)

Mathieu Prevot mathieu.prevot at
Mon Jul 7 19:32:31 CEST 2008


I use in a bourne shell script the following filter:

sed '/watch?v=/! d;s/.*v=//;s/\(.\{11\}\).*/\1/' \
| sort | uniq | awk 'ORS=" "{print $1}'

that give me all sets of 11 characters that follows the "watch?v="
motif. I would like to do it in python on stdout from a
subprocess.Popen instance, using python tools rather than sed awk etc.
How can I do this ? Can I expect something as fast ?


More information about the Python-list mailing list