Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: s/pattern/pattern/g on the commandline ?
- X-seq: zsh-users 16795
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: s/pattern/pattern/g on the commandline ?
- Date: Sun, 26 Feb 2012 10:32:02 -0800
- In-reply-to: <CANPayMT_uqnE=LCnKLh4NKwJiMpOwpmsd3mgDfxf7df=KVNm-w@mail.gmail.com>
- 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: <20120225182450.GA31597@solfire> <CAFOazANiYPxbbLC1UULgUznU_4mA+5W0gYPOKh5LEvAaXdVqBA@mail.gmail.com> <CAFOazAN6DK5eQ9hZBNAm-HwCtsF4B4S9_y8g5mYTwEmZC=h09w@mail.gmail.com> <CANPayMT_uqnE=LCnKLh4NKwJiMpOwpmsd3mgDfxf7df=KVNm-w@mail.gmail.com>
On Feb 25, 7:46pm, Moritz Bunkus wrote:
}
} while we're at it: is there a way to do history expansion without
} actually submitting the modified entry?
I kept waiting for someone to mention this, but no one has yet ...
14.1.4 Modifiers
----------------
p
Print the new command but do not execute it. Only works with
history expansion.
You can stack modifiers, so
!!:p:gs/what/ever
or
!!:gs/what/ever/:p
will both work. Note you need the trailing slash in the second case.
Other delimiters work for s/// -- you can even use a colon, so
!:2:s:what:ever::p
means to take the second word of the previous command, change "what"
to "ever" in that word, and then display the result (and enter it
into the history list) without actually executing it.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author