[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Tak Ota
Subject: uniq
Date: Fri, 3 Dec 2010 18:41:12 -0800

Do we have something equivalent to the next command?  I know the name
is bad as it is not same as UNIQ(1).  It works better because sorting
is not required.


;; uniq
(defun uniq ()
  "Omit duplicated lines."
    (goto-char (point-min))
    (while (not (= (point) (point-max)))
      (let* ((start (point))
             (str (format "^%s"
                           (buffer-substring start
                                             (progn (forward-line 1) 
          (while (re-search-forward str nil t)
            (delete-region (match-beginning 0) (match-end 0))))))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]