From: Devin Mullins Date: 2005-10-07T10:47:09+09:00 Subject: Re: One-liner removing duplicate lines Sean O'Halpin wrote: >On 10/6/05, Robert Klemme wrote: > > >>(David, I'm sorry again this is no #inject solution.) >> >> >I couldn't resist :) > > ruby -e "ARGF.inject({}) {|h, x| h.key?(x) or h[x] = puts(x); h}" > > I think he was looking for a functional (non-side-effecty) version: ruby -e"ARGF.inject(['']) {|s,l| s.include?(l)?s:s<