On 2009-02-17, oamram <oam...@gmail.com> wrote: > i have a directory with about 50 text file and i need to > iterate through them and get line 7 to 11 from each file and > write those lines into another file(one file that will contain > all lines).
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 -- Grant Edwards grante Yow! ... My pants just went at on a wild rampage through a visi.com Long Island Bowling Alley!! -- http://mail.python.org/mailman/listinfo/python-list