Aahz wrote:
> In article ,
> Tim Chase 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:
On Feb 17, 11:03 am, oamram wrote:
> Hi All,
> new to python. 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).
>
import glob
file("output.txt","w")
In article ,
Tim Chase 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 /
On 2009-02-17, Tim Chase 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,11
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
On 2009-02-17, oamram 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
[email protected] wrote:
oamram:
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).
Files can be iterated line-by-line, so this idiom:
for line
oamram:
> 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).
Files can be iterated line-by-line, so this idiom:
for line in file: ...
will give you
oamram a écrit :
Hi All,
new to python. 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).
First create a function that read and parse one file
Then cre
A. Joseph wrote:
I want to read from text file, 25 lines each time i press enter key,
just like the python documentation.
you can use pydoc's pager from your program:
import pydoc
text = open(filename).read()
pydoc.pager(text)
--
http://mail.python.org/mailman/listinfo/python-
10 matches
Mail list logo