Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: subsitutions and beginning of lines.
- X-seq: zsh-users 20739
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Subject: Re: subsitutions and beginning of lines.
- Date: Mon, 12 Oct 2015 02:26:37 +0000
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=957N2epDJXIRBXiwx58E/88prqE=; b=SZw08I ChSBSAY8goTf30aQ+YddS//UepdVapxd4jmeYJ3lOU/vp66ijDkrywBDDYNQLsQ3 akV//y1rvFLWAMrWo6KyRhPolvnh5XLccnS4GLfHxZOcMkVYVZnJEb3zLA+z17YB pvvolHjH9Pge73Ok09uc6EIiLr61k4veMrYSw=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=957N2epDJXIRBXiwx58E/88prqE=; b=b20zB druWkuKIdBKPigouUOpar87XWDEWkn02ROG+TzP9CfdvQq3YMaITr1fL85ndttM8 pnFTyGwe5eJpil7RnhGaDskMGWVv5apEDvtwV7kLRblchQVxLM8Gk0oAQ4sJYxM7 xYYm6icZHCdIvk+Agkqq2dwRmMPIMc/caI7TmA=
- In-reply-to: <561AB49A.4060801@eastlink.ca>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <561AB49A.4060801@eastlink.ca>
Ray Andrews wrote on Sun, Oct 11, 2015 at 12:12:26 -0700:
> ${var// /}
>
> When doing that sort of substitution, is is possible to test for newlines?
> I'm playing with a function that grabs history and I'm trying to strip
> off the leading numbers.
If you're trying to parse something like this:
% history | tail -2
1004 echo foo
1005 echo bar
You could avoid parsing the line numbers (and unescaping the commands)
altogether by accessing the history differently:
% print -r - $history[1004]
echo foo
Messages sorted by:
Reverse Date,
Date,
Thread,
Author