From: "Ara.T.Howard" Date: 2005-08-09T08:45:34+09:00 Subject: Re: One line handies On Tue, 9 Aug 2005, David A. Black wrote: > Hi -- > > On Tue, 9 Aug 2005, Lyndon Samson wrote: > >> Ruby is such a sweet language that you can achieve alot with little code >> >> I'd like to see what 'one-liners' others have come up with. >> >> here's one I find usefull. >> >> ruby -e 'puts ENV["path"].downcase.split(";").sort' >> >> handy for windows but *nix ppl would probably use sed. > > Not necessarily, but we would use PATH and ":" :-) cross platform sed-ness: harp:~ > ruby -r yaml -e 'y ENV[% PATH ].downcase.split(%r [:;] )' --- - "." - "~/bin" - "~/shared/bin" - /home/ahoward/bin - /usr/local/sbin - /usr/sbin - /sbin - /data/bin - /usr/kerberos/bin - /usr/local/bin - /bin - /usr/bin - /usr/x11r6/bin - /dmsp/reference/bin - /usr/local/java/bin ;-) btw - this is the first use i've ever found for using the % trick... -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================