From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: gnuist006@hotmail.com (gnuist006) Newsgroups: gmane.emacs.help Subject: How to implement line sorting, uniquifying and counting function in emacs? Date: 29 Sep 2002 19:13:06 -0700 Organization: http://groups.google.com/ Sender: help-gnu-emacs-admin@gnu.org Message-ID: NNTP-Posting-Host: localhost.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1033352776 7459 127.0.0.1 (30 Sep 2002 02:26:16 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 30 Sep 2002 02:26:16 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17vqGE-0001wB-00 for ; Mon, 30 Sep 2002 04:26:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17vqGS-0001PT-00; Sun, 29 Sep 2002 22:26:28 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.lang.lisp,gnu.utils.help,comp.unix.shell,comp.unix.programmer Original-Lines: 22 Original-NNTP-Posting-Host: 209.178.178.122 Original-X-Trace: posting.google.com 1033351986 25672 127.0.0.1 (30 Sep 2002 02:13:06 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 30 Sep 2002 02:13:06 GMT Original-Xref: nntp.stanford.edu gnu.emacs.help:105525 comp.lang.lisp:94987 gnu.utils.help:4058 comp.unix.shell:133577 comp.unix.programmer:143531 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:2069 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:2069 In shell you can do this: cat file | sort | uniq -d | wc to count the repeated lines. You can also do cat file | sort | uniq -u | wc to count the unique lines. Sometimes I have to do this on windows platform where I do have emacs. This means that I cannot escape to shell and that route is not available. Lisp has sort-lines, but no uniq -u or uniq -d available. Also I do not know the equivalent to wc. This is where some help is requested. I think that this is not only a problem of lisp programming, but also algorithms. Which group has this kind of expertise? Cheers! gnuist