Reading from text

Aahz aahz at
Fri Mar 6 19:44:57 CET 2009

In article <mailman.140.1234896250.11746.python-list at>,
Tim Chase  <python.list at> wrote:
>> Assuming this is a real task and not a homework problem, then
>> I'd do it this way:
>>   $ cd [directory containing 50 test files]
>>   $ (for file in *; do head -n11 $file | tail -n5; done) >/path/to/results-file.txt
>I'd use sed:
>   sed -ns 7,11p /source/path/*.txt >/path/to/results.txt
>hard to get much more concise than that with any common tool :)

But you do have to learn sed.  Avoiding that is precisely why I stick
with Python.
Aahz (aahz at           <*>

"All problems in computer science can be solved by another level of     
indirection."  --Butler Lampson

More information about the Python-list mailing list