On 16/01/2021 22:33, Martin Gregorie wrote:
> On Sat, 16 Jan 2021 20:39:09 +0000, Pancho wrote:
>
>> On 16/01/2021 17:53, Martin Gregorie wrote:
>>
>>
>>> sudo tail -f /var/log/messages | awk -- '{ print $0 }'
>>>
>>> which works here.
>>>
> Messages added to /var/log/messages with the following command are
> displayed almost instantly, though they aren't exactly readable since the
> text is shown as a hex string:
>
> sudo echo "Another message" 2>&1 | logsave /var/log/messages -
>
Why not just use the logger command?
e.g.
logger "Another message"
You seem to be over complicating things: why redirect stderr to stdin
2>&1 from echo, echo doesn't need sudo, logsave /var/log/messages does
need sudo, logsave is truncating /var/log/messages.
The immediate response you are seeing is stderr from tail, which isn't
being piped to awk at all. This error message is generated by tail -f
because logsave truncates the file that is being tailed, logsave -a appends.
The manual says pipes are buffered. My experiments say pipes are buffered.
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|