coreutils
[Top][All Lists]
Advanced

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

Re: feature request: tail -H


From: Jim Meyering
Subject: Re: feature request: tail -H
Date: Tue, 24 Nov 2015 18:39:04 +0100

On Tue, Nov 24, 2015 at 4:03 PM, Pádraig Brady <address@hidden> wrote:
> On 24/11/15 01:22, Pádraig Brady wrote:
>> On 22/11/15 20:16, Bob Proulx wrote:
>>> Pádraig Brady wrote:
>>>> Upon more careful consideration, I'm 50:50
>>>> about adding per line processing to tail.
>>>> ...
>>>> Perhaps we could just add the above snippet to the docs?
>>>> The big advantage is that it works everywhere already.
>>>
>>> Perhaps simply add a reference to 'multitail' being available?  It is
>>> still my preferred tool for that type of thing.
>>
>> I could only see how to prefix with the window id in multitail,
>> and anyway it would be better to reference more standard tools if possible.
>>
>> Proposed doc patch is attached.
>
> correct patch this time :/

Looks fine. Thanks!

Here's input for a small example using the suggested awk snippet:

  $ tail -n3 <(seq 3) <(seq 9)
  ==> /proc/self/fd/11 <==
  1
  2
  3

  ==> /proc/self/fd/12 <==
  7
  8
  9

It would be slightly better if tail's empty separator line were not
attributed to the first file:

  $ tail -n3 <(seq 3) <(seq 9) |awk '/^==> .* <==$/
{prefix=substr($0,5,length-8)":"; next} {print prefix$0}'
  /proc/self/fd/13:1
  /proc/self/fd/13:2
  /proc/self/fd/13:3
  /proc/self/fd/13:
  /proc/self/fd/14:7
  /proc/self/fd/14:8
  /proc/self/fd/14:9

But since this postprocessing is not robust in the face of an embedded
"==> ... <==" line, it may not be worth adjusting.



reply via email to

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