Jussi Piitulainen writes:
> Daniel Fetchinson writes:
>
> > The pattern is that the first line is deleted, then 2 lines are
> > kept, 3 lines are deleted, 2 lines are kept, 3 lines are deleted,
> > etc, etc.
>
> So, is there some simple expression in Python for this?
(item for i, item in enumera
Tim Chase writes:
> On 10/27/10 09:39, Jussi Piitulainen wrote:
>>> So, is there some simple expression in Python for this? Just asking
>>> out of curiosity when nothing comes to mind, not implying that there
>>> should be or that Python should be changed in any way.
>>
>> To expand, below is the
On 10/27/10 09:39, Jussi Piitulainen wrote:
So, is there some simple expression in Python for this? Just asking
out of curiosity when nothing comes to mind, not implying that there
should be or that Python should be changed in any way.
To expand, below is the best I can think of in Python 3 and
Jussi Piitulainen writes:
> Daniel Fetchinson writes:
>
> > This question is really about sed not python, hence it's totally
> > off. But since lots of unix heads are frequenting this list I
> > thought I'd try my luck nevertheless.
> ...
> > using python. The pattern is that the first line is de
Daniel Fetchinson writes:
> This question is really about sed not python, hence it's totally
> off. But since lots of unix heads are frequenting this list I
> thought I'd try my luck nevertheless.
...
> using python. The pattern is that the first line is deleted, then 2
> lines are kept, 3 lines
>> using python. The pattern is that the first line is deleted,
>> then 2 lines are kept, 3 lines are deleted, 2 lines are kept,
>> 3 lines are deleted, etc, etc.
>
> If you have GNU sed, you can use
>
>sed -n '2~5{N;p}'
>
> which makes use of the GNU "~" extension. If you need a more
> portabl
On 10/25/2010 11:25 AM, Daniel Fetchinson wrote:
using python. The pattern is that the first line is deleted,
then 2 lines are kept, 3 lines are deleted, 2 lines are kept,
3 lines are deleted, etc, etc.
If you have GNU sed, you can use
sed -n '2~5{N;p}'
which makes use of the GNU "~" extens
This question is really about sed not python, hence it's totally off.
But since lots of unix heads are frequenting this list I thought I'd
try my luck nevertheless.
If I have a file with content
1
2
3
4
5
6
7
8
...
i.e. each line contains simply its line number, then it's quite easy
to conve