in reply to Re: Removing repeated words
in thread Removing repeated words

++, this is more a -n than -p task though. perl -lane 'print grep !$s{$_}++, @F'

Looks quite a bit less daunting, not don't it. :-)

Update: good catch, blakem++. The devil is in the details, they say in German..

Makeshifts last the longest.

Replies are listed 'Best First'.
Re3: Removing repeated words
by blakem (Monsignor) on Sep 20, 2002 at 15:23 UTC
    The words run together if you just print the list, though $, can take care of that....
    % perl -lane 'print grep !$s{$_}++, @F' one two two three onetwothree % perl -lane '$,=$"; print grep !$s{$_}++, @F' one two two three one two theee

    -Blake