From: "Ara.T.Howard" Date: 2005-08-09T08:50:17+09:00 Subject: Re: One line handies On Tue, 9 Aug 2005, Ara.T.Howard wrote: > 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 [:;] )' oops harp:~ > ruby -r yaml -e 'y (ENV[% PATH ] || ENV[% path ]).downcase.split(%r [:;] )' -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 ===============================================================================