X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; q=dns; s=default; b=rMUpxwJWMcIlRo9b7T9cU4k6FEZuXez7fr4kE5KNZOa bd5XP2uMhQf9ikmgoUfpzc9eeguwdulLo3OZ1UcvA0aAWK3thEKp6gbiSSjjpjaB AuRDdFXSmZLNCSSLiUpTUkjbIydbZqI7m3FFPteuAuSIcybJA9cj8NcsJ4cWh6Ec = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; s=default; bh=DN7pJdR7lxbh/GCB32evfkhNiL4=; b=CnvgC53BJcoG5HMlp rsc/CCPqXMuiaqIlMBsgBsKZdPmYVvf93vgWkhyINcstn3FiQ9rg63Bwgohax8DP iNpOwVCWMHuteKZQeapMTBOfBtjt+w6e9fc8HWXxfgYtmhhmKPc5y0F21kEwx6SE 2Ghp5lTYby0FytYockPOGJ4X2A= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.3 required=5.0 tests=BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=tao, Tao, vieira, Vieira X-HELO: mail-qk0-f171.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=xWFvK8DDtvQyCuJm1+hec5JlAYAbXfdbb3yW/PGJmOA=; b=R3qj4bheADTJJDwHP9GNxLpvnKv6KuwKisIAYNtT9oSxxD6zsEzd5ZJvElBt1K+qmy RIcSzOVXIL7DQvfN27GeWvCZdy0vwrONF9xY0U5fWrIYkxm/kJkmgXTiBdox8DRABxAk a+HJ3ltyOX6KfEEBqF5lNt6raD/g570MxUr+0eicRO3dXUFzGXZciUKBLyQ1O5/2vF2G mO1DPReJW7lUCz8dxUqPe5B8hyr/qOlt+kXqTVNF1JDL06vs+4rgZH9vfTIVo7n+SPXb 89nfsVS2fZesQN7aHsSkVLIQhQVVsDNFdQ/2cjCVhZV1z+8OstC4Jy0T9RIVE0kU58PV uzCA== X-Gm-Message-State: AA6/9RnIzDZ1TOwNQAGRFrVkW9qrDgQH0K1hVwi+r61qRs8dWSIEszeoWYXhsLtY0R5XrJwn5knvY2LMeAf8Rg== X-Received: by 10.194.84.144 with SMTP id z16mr4026039wjy.210.1476183414495; Tue, 11 Oct 2016 03:56:54 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Csaba Raduly Date: Tue, 11 Oct 2016 12:56:54 +0200 Message-ID: Subject: Re: uniq not working To: cygwin list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u9BAvSSt030214 Hi Felipe, On Tue, Oct 11, 2016 at 12:43 PM, Felipe Vieira wrote: > Dear mailing list, > > the uniq program seems to be faulty on my cygwin: > > /tmp » cat u.txt > 1 > 2 > 3 > 4 > 5 > 1 > 2 > 3 > 6 > 7 > 8 > > > /tmp » uniq -c u.txt > 1 1 > 1 2 > 1 3 > 1 4 > 1 5 > 1 1 > 1 2 > 1 3 > 1 6 > 1 7 > 1 8 > 1 > /tmp » > > As you can see it does not eliminate duplicate lines. > This file was created with vim. Same results if created with windows notepad. > What am I missing? You are missing an important step: reading the manual. $ man uniq UNIQ(1) User Commands UNIQ(1) NAME uniq - report or omit repeated lines SYNOPSIS uniq [OPTION]... [INPUT [OUTPUT]] DESCRIPTION Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output). ^^^^^^^^^ uniq collapses identical lines only if they are consecutive. The typical way to ensure this is to sort the file first. $ sort c.txt | uniq Csaba -- GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++ The Tao of math: The numbers you can count are not the real numbers. Life is complex, with real and imaginary parts. "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds "People disagree with me. I just ignore them." -- Linus Torvalds -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple