http://www.perlmonks.org?node_id=1025215


in reply to perl sort on windows

cause I think the -k is interpreted as specifying the input twice. ow would I change this so that its as equivalent as possible but runs on windows? Thanks

And what does the documentation say?

I'm on windows, I have two sort.exe files on my system, one came with perl, the other is gnu sort

They have different syntaxs

I don't use the windows version much, but to avoid breaking some batch files and stuff that rely on it, I also named the gnu version gsort.exe

You can distinguish between the two

$ sort /? |head SORT [/R] [/+n] [/M kilobytes] [/L locale] [/REC recordbytes] [[drive1:][path1]filename1] [/T [drive2:][path2]] [/O [drive3:][path3]filename3] /+n Specifies the character number, n, to begin each comparison. /+3 indicates th +at each comparison should begin at the 3rd character in each line. Lines with fewe +r than n characters collate before other l +ines. By default comparisons start at the firs +t character in each line. $ gsort /? gsort: open failed: /?: Invalid argument

Replies are listed 'Best First'.
Re^2: perl sort on windows (sort.exe , gnusort.exe )
by Anonymous Monk on Mar 25, 2013 at 01:13 UTC

    one came with perl,

    one came with WINDOWS, jeez

Re^2: perl sort on windows (sort.exe , gnusort.exe )
by gurpreetsingh13 (Scribe) on Mar 25, 2013 at 11:32 UTC
    sort /+2 /+4 /T $windowsDir $name /O tempLoc_$name
    This should work I believe, only problem is with numeric sort.