[GRASS-dev] Re: [GRASS GIS] #181: tac command missing in OSX

GRASS GIS trac at osgeo.org
Thu Jun 5 17:00:09 EDT 2008


#181: tac command missing in OSX
------------------------+---------------------------------------------------
  Reporter:  kyngchaos  |       Owner:  grass-dev at lists.osgeo.org
      Type:  defect     |      Status:  new                      
  Priority:  minor      |   Milestone:  6.3.1                    
 Component:  default    |     Version:  6.3.0                    
Resolution:             |    Keywords:  v.in.garmin, v.in.mapgen 
------------------------+---------------------------------------------------
Comment (by glynn):

 Replying to [comment:9 hamish]:

 > While not POSIX, I think tac will be widely available. I would still
 like to hear from Cygwin/MSys/other platforms.

 Cygwin has it. My MSys installation doesn't, but it's quite out of date
 (it has separate textutils and fileutils; AFAICT, newer versions have
 coreutils, which probably has it). I suspect that non-GNU systems (e.g.
 Solaris) probably won't have it.

 > Glynn:
 > > Off the top of my head, the only thing that I can think of is to
 prefix
 > > each line with the line number using e.g. awk, use "sort -r", then
 strip
 > > the line numbers.
 >
 > awk would be a great solution as this is fed directly into that. But I
 have no idea how to write that.

 Replace:
 {{{
 ... | tac | ...
 }}}
 with:
 {{{
 ... | awk '{print NR,$0}' | sort -nr | sed 's/^[0-9]* //' | ...
 }}}

 > > I wonder if some sort of requirement in GRASS 7 development would be a
 good
 > > idea to stick to POSIX/SUS commands?
 >
 > that is the current goal, but I see little reason to go nuts trying to
 be very strict about that, e.g. for something like `which` that may not be
 POSIX but is, literally, everywhere. ie the overwhelming common use
 exemption.

 I don't see any reason to use "which" when "type" is mandated by POSIX.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/181#comment:10>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list