Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Strip a Carriage-Return from a string/variable
- X-seq: zsh-users 14322
- From: Matt Wozniski <godlygeek@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Strip a Carriage-Return from a string/variable
- Date: Tue, 25 Aug 2009 19:21:37 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=G9XRhVFfk2G0+hceoemxovzQQ0CPsoNOxdTRsFyzrm8=; b=hl039f+whyWSGEfF+3xOPs7V6ARBoImhIvI0VOpkvdWTZEqlmw+ppngazHthcUghcc Y9LB/eDh4BOOHDQ2IMeA3dwLAtNoUtaDKL5uob0djugSKpBuOB3e7ZjrNfT/JIu83omU oq7W3qtdYCmhUng/aHeNnB8BTXsZlaST0/L6s=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=acg7abzvetqGCs2qvbanNlEMLMg239h2EGTYBLgbftw/SpdIObv6wxYNu0UvmDxDAL l9ZmzQ/wVdvjyAan/kjcsgmS/Nh3MBGD3umDIzDYnpkMXDNNG1GgLDQZn5ZumNu/yccE bMvfOdmTmQHPRlGiKPZLPwQmGgQ6SPFqysnBg=
- In-reply-to: <Xns9C72E8978E856zzappergmailcom@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns9C72ADE69DF67zzappergmailcom@xxxxxxxxxxxx> <200908251612.n7PGCkki001668@xxxxxxxxxxxxxx> <Xns9C72E8978E856zzappergmailcom@xxxxxxxxxxxx>
On Tue, Aug 25, 2009 at 5:52 PM, zzapper wrote:
> Peter Stephenson wrote:
>
>> zzapper wrote:
>
>> % foo=$'bar\r'
>> % print $foo | xxd
>> 0000000: 6261 720d 0a               bar..
>> % print ${foo%%$'\r'} | xxd
>> 0000000: 6261 720a                Âbar.
>>
> Thanks Peter
> And anywhere in the variable/any number of times?
Then you'd go with what Frank Terbeck suggested.
% foo=$'bar\r\rbaz'
% print $foo | xxd
0000000: 6261 720d 0d62 617a 0a bar..baz.
% print ${foo//$'\r'/_} | xxd
0000000: 6261 725f 5f62 617a 0a bar__baz.
~Matt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author