[exim] Re: Best way to split multiline string

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Kirill Miazine
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: [exim] Re: Best way to split multiline string
• Jeremy Harris via Exim-users [2024-10-12 22:44]:
> On 12/10/2024 20:36, Ian Z via Exim-users wrote:
>> The program outputs multiple lines, only the first
>> is relevant to me. What is the least painful way to extract it?
>
> Probably a ${sg } (assuming you don't have to handle *escaped*
> newlines)


${sg} was also my first initial reaction, but then I thought, maybe
${extract} with newline as separator is less painful?

works for the first line:

> ${extract{1}{\n}{${readfile{/etc/group}}}}

wheel:*:0:root,km

works for the 10000th line:

> ${extract{10000}{\n}{${readfile{/var/log/exim/mainlog}}}}

2024-10-08 23:21:49.807 1syJWV-0000000065x-2IiR <km@???>:
dovecot_pipe transport output: lda(km@???): Error:
net_connect_unix(/var/dovecot/stats-writer) failed: Permission denied

works for 10000th line with ${run}, too:

> ${extract{10000}{\n}{${run{/bin/cat /var/log/exim/mainlog}{$value}}}}

2024-10-08 23:21:49.807 1syJWV-0000000065x-2IiR <km@???>:
dovecot_pipe transport output: lda(km@???): Error:
net_connect_unix(/var/dovecot/stats-writer) failed: Permission denied

have to look at that permission error there, I guess :)

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/