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 14323
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Strip a Carriage-Return from a string/variable
- Date: Wed, 26 Aug 2009 11:18:35 +0000 (UTC)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: SuccessTheory
- References: <Xns9C72ADE69DF67zzappergmailcom@xxxxxxxxxxxx> <200908251612.n7PGCkki001668@xxxxxxxxxxxxxx> <Xns9C72E8978E856zzappergmailcom@xxxxxxxxxxxx> <17393e3e0908251621u7423cb1bk10c767b5b9ed19ef@xxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Matt Wozniski wrote in
news:17393e3e0908251621u7423cb1bk10c767b5b9ed19ef@xxxxxxxxxxxxxx:
>> 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
>
>
Whoops thanks Frank & Matt.
On my cygwin had to use \n
foo=$'bar\n\nbaz'
print $foo
bar
baz
>
>print ${foo//$'\n'}
barbaz
--
zzapper
Messages sorted by:
Reverse Date,
Date,
Thread,
Author