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

Re: Strip a Carriage-Return from a string/variable



zzapper <david@xxxxxxxxxx>:
> print ${somevar//[^[:alnum:]]/_}   # replace all non-alphanumerics with _
> 
> But how to delete just a trailing or not carriage return?

cr=$'\r'
print ${foo//${cr}/_}

Regards, Frank



Messages sorted by: Reverse Date, Date, Thread, Author