Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Truncate without padding
- X-seq: zsh-users 9598
- From: DervishD <zsh@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Truncate without padding
- Date: Mon, 31 Oct 2005 18:21:33 +0100
- Cc: Zsh Users <zsh-users@xxxxxxxxxx>
- In-reply-to: <1051031153512.ZM17476@xxxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: DervishD
- References: <20051031112743.GA1048@DervishD> <1051031153512.ZM17476@xxxxxxxxxxxxxxxxxxxxxxx>
Hi Bart :)
* Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> On Oct 31, 12:27pm, DervishD wrote:
> }
> } I would like to print a string truncated *but* without padding
>
> Just truncate it first with padding, and then strip the padding.
Sorry, I didn't mention that it has to be done in one step
(namely in the print command) and the "string" to be printed is $*.
I think I could save "$*" in a parameter (it won't be splitted
nor any other thing except printed) and apply your solution :)
Anyway, is there a way of doing all in one step, with the
restrictions I mention above?
> You can pick some other character than NUL if you know that
> character doesn't appear in the string, in which case you don't
> need the (p) flag.
It's OK to use '\0' if I apply this solution, althoug it is not
needed because ALL pad characters will be " " and ALL pad characters
will be added by the pad flags. The string won't have trailing or
leading spaces (well, it is not supossed to...) Thanks :)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
Messages sorted by:
Reverse Date,
Date,
Thread,
Author