http://www.perlmonks.org?node_id=246775


in reply to one liner to print out sorted list of word

Why is everyone trying to reinvent the wheel?
sort -u file # case sensitive sort -fu file # insensitive
That takes care of lines. To change the interpretation of what a line is, use tr(1), f.ex
< file tr [:blank:] '\n' | sort -fu
Shell still excels at really simple things it has dedicated tools for. Perl beats it if you want to do something there's no exactly matching tool for.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: one liner to print out sorted list of word (sort(1))
by Anonymous Monk on Mar 30, 2003 at 21:27 UTC

    Isn't ShellMonks up the road somewhere?

Re: Re: one liner to print out sorted list of word (sort(1))
by maksl (Pilgrim) on Mar 30, 2003 at 21:06 UTC
    thx a lot Aristotle for your "_minimalistic_" reply :)
    update: second even shorter line with code from dakkar
    < file tr [:blank:],[:punct:] '\n' | sort -fu < file tr -cs '[:alnum:]' '\n'|sort -fu
    is exactly what i was looking for!!!
    never saw the file redirector < on the beginning of a shell command, i use it for things like:
    mail -s "test" person@what_ever.org < file