delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/03/02/23:44:12

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Date: Tue, 2 Mar 2010 20:43:59 -0800
From: Todd Stansell <tjs AT tellme DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: "tail" command does not work as advertised
Message-ID: <20100303044359.GH27220@shell02.cell.sv2.tellme.com>
References: <4B8DCB6C DOT 3010207 AT columbus DOT rr DOT com> <2bf229d31003021901g4c7f3b8fu340c1be2886d5f3 AT mail DOT gmail DOT com> <4B8DD7DF DOT 6090006 AT redhat DOT com>
Mime-Version: 1.0
In-Reply-To: <4B8DD7DF.6090006@redhat.com>
User-Agent: Mutt/1.4.2.2i
X-Proofpoint-Virus-Version: vendor=nai engine=5400 definitions=5908 signatures=605028
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

This is a side affect of the change to the newer POSIX standard.  For instance,
to use the old standard:

    503:$ _POSIX2_VERSION=199209
    504:$ export _POSIX2_VERSION
    505:$ ps -a | tail +5
	 2864       1    2864       2864  con 718399 19:26:01 /usr/bin/rxvt
	 7612    2864    7612       2328    1 718399 19:26:01 /usr/bin/bash
	 7052    7612    7052       3740    1 718399 19:31:39 /usr/bin/ps
	 1468    7612    7052       3640    1 718399 19:31:39 /usr/bin/tail

  http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#Old-tail-plus-N-syntax-now-fails

Todd

On Tue, Mar 02, 2010 at 08:30:39PM -0700, Eric Blake wrote:
> According to Chris Sutcliffe on 3/2/2010 8:01 PM:
> >> The "tail +4" commands does not work as advertised.  When given such command
> >> (advertised in man command), it complains it can't open the file.  With the
> >> command "tail +5 -", it produces the desired output with some junk on
> >> standard output.
> > 
> > As per the tail manpage:
> > 
> >        -n, --lines=N
> >               output the last N lines, instead of the last 10; or use
> > +N to output lines starting with the Nth
> > 
> > Note that the +N notation is specific to --lines=, not the '-n'
> > shorthand.
> 
> Wrong - the +N notation also works with -n:
> 
> ps -a | tail -n +5
> 
> -- 
> Eric Blake   eblake AT redhat DOT com    +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
> 



--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019