Reading from text
Steve Holden
steve at holdenweb.com
Sun Mar 8 23:18:19 EDT 2009
Aahz wrote:
> In article <mailman.140.1234896250.11746.python-list at python.org>,
> Tim Chase <python.list at tim.thechases.com> 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.
+1 [cross-platform] QOTW
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Want to know? Come to PyCon - soon! http://us.pycon.org/
More information about the Python-list
mailing list