Make a word list from a text
Mark A. Taff
marktaff at comcast.net
Sat Aug 2 05:00:20 UTC 2008
On Friday 01 August 2008 20:52:46 Wulfy wrote:
> I want to take a text file and extract all the words and sort them into
> a unique list. I've looked at split, cut, sed and awk (the last two
> just confused me no end... :@( ) and I can't find a imple way to do
> it. I suppose I could write a Java program to do it, but it seems silly
> to reinvent the wheel like that. I'm sure there are a bazillion ways to
> do it on the command line but I'm flummoxed. I tried googling and every
> search string I tried brought me dozens of Windows programs to do the
> job or python programs, but nothing I could understand...
>
> --
> Blessings
>
> Wulfmann
>
> Wulf Credo:
> Respect the elders. Teach the young. Co-operate with the pack.
> Play when you can. Hunt when you must. Rest in between.
> Share your affections. Voice your opinion. Leave your Mark.
> Copyright July 17, 1988 by Del Goetz
How about:
perl -e '$data = `cat ./pgadmin.log`; @words = split(/ /, $data); foreach \
$word (@words) { print "$word\n"; }'|sort|uniq
Replace ./pgadmin.log with your FILE.
HTH,
Mark
More information about the kubuntu-users
mailing list