bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Proposed new feature: head --show-truncation


From: Stepan Kasal
Subject: Re: Proposed new feature: head --show-truncation
Date: Thu, 21 Aug 2003 11:25:35 +0200
User-agent: Mutt/1.2.5.1i

Hello,

On Wed, Aug 20, 2003 at 09:23:08PM +0100, Ed Avis wrote:
> A reasonable argument against --show-truncation would be to
> demonstrate that it can be done with a trivial shell script wrapping
> head itself.

What about

n=2
cat ~/todo | (head /dev/null; sed $n'!b;n;s/.*/[[trunc]]/;q')

or

n=2
cat ~/todo |
        while read l
        do
                n=`expr $n - 1`
                if [ $n -lt 0 ]
                then
                        echo '[[trunc]]'
                        break
                fi
                echo $l | head
        done

;-)

I mean that trivial shell script which doesn't use "head" should also
count.

Stepan




reply via email to

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