UNIX-style sort in Python?

Bengt Richter bokr at oz.net
Mon Oct 18 17:09:10 EDT 2004


On Mon, 18 Oct 2004 09:27:45 +0200, aleaxit at yahoo.com (Alex Martelli) wrote:

>Grant Edwards <grante at visi.com> wrote:
>
>> On 2004-10-18, Kotlin Sam <xavier_onasis at hotmail.com> wrote:
>> 
>> > For a while at least I have to work in Windows rather than UNIX, which
>> > is more familiar. I'm trying to do with Python some of the things that
>> > I've done for years in shell, in particular, sort. The shell sort is
>> > pretty easy to use:
>> 
>> Sounds like you need to install Cygwin so you have a real bash
>> shell and all of the normal shell utilities.
>
>An excellent piece of advice.  Cygwin has occasionally save my sanity in
>the past when the weakness of Windows' cmd.exe was getting to me...!-)
>
Most of my cmd.exe use is to invoke xxx ..args where xxx.cmd in a path directory
is one line like @python c:\util\xxx.cmd %* (I don't like the kludgy windows
first-line trick that requires xxx.py itself to be named xxx.cmd)
;-)

But, have you tried msys/mingw ? I haven't done a lot with it, but it is nice,
and supports most of the basic utilities including compiler/linker, though
I prefer gvim directly over the vim via msys shell (I probably don't have
the latter configured quite right).

A sampling:

[13:59] ~>ls /
bin  doc  etc  home  local  m.ico  mdk  mingw  msys.bat  msys.ico  uninstall
[14:00] ~>ls /bin
awk           diff.exe     ftp               libW11.dll    mv.exe     sed.exe       tr.exe
basename.exe  diff3.exe    gawk.exe          ln.exe        od.exe     sh.exe        true.exe
bunzip2       dirname.exe  grep.exe          lnkcnv        patch.exe  sleep.exe     uname.exe
bzip2.exe     echo         gunzip            ls.exe        printf     sort.exe      uniq.exe
cat.exe       egrep        gzip.exe          m4.exe        ps.exe     split.exe     vi
chmod.exe     env.exe      head.exe          make.exe      pwd        start         view
cmd           ex           id.exe            makeinfo.exe  rm.exe     tail.exe      vim.exe
cmp.exe       expr.exe     info.exe          md5sum.exe    rmdir.exe  tar.exe       wc.exe
comm.exe      false.exe    infokey.exe       mkdir.exe     rvi        tee.exe       which
cp.exe        fgrep        install-info.exe  mount.exe     rview      texi2dvi      xargs.exe
cut.exe       find.exe     install.exe       msys-1.0.dll  rvim       texindex.exe
date.exe      fold.exe     less.exe          msysinfo      rxvt.exe   touch.exe
[14:00] ~>which gcc
/mingw/bin/gcc
[14:00] ~>ls /mingw/bin
a2dll          dlltool.exe   g77.exe    mingw32-c++.exe   objdump.exe   res2coff.exe
addr2line.exe  dllwrap.exe   gcc.exe    mingw32-g++.exe   pexports.exe  size.exe
ar.exe         dos2unix.exe  gccbug     mingw32-gcc.exe   protoize.exe  strings.exe
as.exe         drmingw.exe   gcov.exe   mingw32-make.exe  ranlib.exe    strip.exe
c++.exe        dsw2mak       gdb.exe    mingwm10.dll      readelf.exe   unix2dos.exe
c++filt.exe    exchndl.dll   gprof.exe  nm.exe            redir.exe     unprotoize.exe
cpp.exe        g++.exe       ld.exe     objcopy.exe       reimp.exe     windres.exe
[14:00] ~>

Regards,
Bengt Richter



More information about the Python-list mailing list