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
On 10/27/10 08:27, Martin Gregorie wrote:
(2) made me take care of 2 files instead of 1 from now on.
Not necessarily:
$ cat heredoc.sh
#!/usr/bin/env bash
python<< 'EOF'
print "hello world"
def foo():
print "foo()"
foo()
EOF
$
Or even better:
$ cat hello
#!/usr/bin/python
print "hello
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
On Wed, 27 Oct 2010 03:28:16 -0700, Lie wrote:
> On Oct 26, 4:04 am, Daniel Fetchinson wrote:
>
>> (2) made me take care of 2 files instead of 1 from now on.
>
> Not necessarily:
>
> $ cat heredoc.sh
> #!/usr/bin/env bash
> python << 'EOF'
> print "hello world"
> def foo():
> print "foo()"
On Oct 26, 4:04 am, Daniel Fetchinson
wrote:
> (2) made me take care of 2 files instead of 1 from now on.
Not necessarily:
$ cat heredoc.sh
#!/usr/bin/env bash
python << 'EOF'
print "hello world"
def foo():
print "foo()"
foo()
EOF
$
$ ./heredoc.sh
hello world
foo()
--
http://mail.python.or
>> 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
11 matches
Mail list logo