Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Truncate strings in array



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