Sort tool using Perl one-liner

Discussion Forums discussion Sort tool using Perl one-liner

This topic contains 0 voices and has 3 replies.

Viewing 4 posts - 1 through 4 (of 4 total)
Author Posts
Author Posts
September 16, 2009 at 9:37 am #685

waz
Member

I made this simple tool to sort lines:

Command: %(CYGWIN_ROOT)binperl.exe

Parameters: -we ‘print sort <STDIN>’

Pass my selection to this tool using Standard Input = true

Capture Output? = Replace my selection.

It partly works, but gobbles some (or all) of the lines. I’ve played around with different ways of doing it in Perl, all with the same result. The Perl works as it should when run from a Cygwin shell.

Has anyone seen anything like this before, or can offer a solution? Do you think it’s a PN bug, or have I done something silly?

Versions:

PN v2.0.10.1010-dizzy

Perl5 v10.0 patch 34065 (osname=cygwin, osvers=1.5.25)

September 16, 2009 at 10:11 am #16757

waz
Member

It works ok if I direct the output to the output window. I do notice a NUL character included with the output — could PN see this NUL character and consider that to be the end of the output?

September 16, 2009 at 10:14 am #16758

waz
Member

Yay. It was the NUL’s fault. This works:

command: perl.exe

params: -we 'print sort map {s/\0//g; $_} <STDIN>'

September 16, 2009 at 1:03 pm #16759

simon
Key Master

Thanks, I can reproduce this with ActivePerl, I’ll need to work out what’s going on, but I reproduced it with this simple example:

a
b
d
f
e
c

->

a
b
c

With activeperl I had to change the parameters to use double-quotes instead of single.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.