From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3232 invoked by alias); 11 Oct 2016 10:56:59 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 3129 invoked by uid 89); 11 Oct 2016 10:56:58 -0000 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 Received: from mail-qk0-f171.google.com (HELO mail-qk0-f171.google.com) (209.85.220.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Oct 2016 10:56:56 +0000 Received: by mail-qk0-f171.google.com with SMTP id o68so26296261qkf.3 for ; Tue, 11 Oct 2016 03:56:56 -0700 (PDT) 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 Received: by 10.194.113.129 with HTTP; Tue, 11 Oct 2016 03:56:54 -0700 (PDT) In-Reply-To: References: From: Csaba Raduly Date: Tue, 11 Oct 2016 10:58:00 -0000 Message-ID: Subject: Re: uniq not working To: cygwin list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2016-10/txt/msg00155.txt.bz2 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 =C2=BB cat u.txt > 1 > 2 > 3 > 4 > 5 > 1 > 2 > 3 > 6 > 7 > 8 > > > /tmp =C2=BB 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 =C2=BB > > As you can see it does not eliminate duplicate lines. > This file was created with vim. Same results if created with windows note= pad. > 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 --=20 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 Torv= alds "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