I stand humbled. On Jan 22, 2012, at 2:25 PM, Tim Chase wrote:
> On 01/22/12 08:45, Roy Smith wrote: >> I would do this with standard unix tools: >> >> grep '^[012]' input.txt> first-three-seconds.txt >> grep '^[34]' input.txt> next-two-seconds.txt >> grep '^[567]' input.txt> next-three-seconds.txt >> >> Sure, it makes three passes over the data, but for 20 MB of data, you >> could have the whole job done in less time than it took me to type this. > > > If you wanted to do it in one pass using standard unix tools, you can use: > > sed -n -e'/^[0-2]/w first-three.txt' -e'/^[34]/w next-two.txt' -e'/^[5-7]/w > next-three.txt' > > -tkc > > > -- Roy Smith r...@panix.com -- http://mail.python.org/mailman/listinfo/python-list