Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Truncate strings in array
- X-seq: zsh-users 21589
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Roman Neuhauser <neuhauser@xxxxxxxxxx>
- Subject: Re: Truncate strings in array
- Date: Sun, 22 May 2016 13:14:32 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cxLVsOOMmWb4HzUQ8DG10P2CF0NN32s/uI7l55Qxbzs=; b=oKIxMvquZdHe9YvnhlcyW71iy5nCyvc2FAMSG9KcymG6Sg+92JxZCdQ+u8DRI9B0bo jVq0PFD+s4245Z2ll0KIzKDvlj76FBU7Kqsylu7JSGOY/yOrVWCUmW8zztUR1AKEsbHj erEkaVwxPcx0pAGbMkD2nE19bkkS0YDxBQWfqwXqiQMvJRciTGklXC3R2H7owjvbcbjZ z6SJ2+OHVS0aVPhHawpHpB4mmj+zH8nz68FvuWp/pD5I+tYFEFC7zDnqMav6pNE2GJly w7u+67MyvzCNmTo9krsYMnxvPV8sMkZFB9I6pjlT7vjWbB9TjYgvtNZV0JA1JpjqJrex sziQ==
- In-reply-to: <20160522102218.GF3514@isis.sigpipe.cz>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCB8XmiiLX52VwBT+_JBS9JTi8cKuviex4mvqsyAjSZ4A@mail.gmail.com> <20160522102218.GF3514@isis.sigpipe.cz>
On 22 May 2016 at 12:22, Roman Neuhauser <neuhauser@xxxxxxxxxx> wrote:
> # sgniazdowski@xxxxxxxxx / 2016-05-22 09:20:10 +0200:
>> having array of strings, is it possible to nicely truncate the strings
>> to given length? Could iterate the array and do truncation, but maybe
>> there's a one liner?
>
> print -l ${strings/(#m)*/$MATCH[1,30]}
Works, thanks
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author