I want to delete the end of every line from the last - onwards.
Can I pattern match $- and then dw using vim?
|
|
0
|
|
|
|
Reply
|
bjlockie
|
2/5/2011 8:58:23 PM |
|
2011-02-5, 12:58(-08), bjlockie:
> I want to delete the end of every line from the last - onwards.
> Can I pattern match $- and then dw using vim?
:%s/-[^-]*$//
or
:%s/\(.*\)-.*/\1/
or (vim specific):
:%norm $F-D
or:
:%s/.*\zs-.*//
--
Stephane
|
|
0
|
|
|
|
Reply
|
Stephane
|
2/6/2011 4:38:49 PM
|
|
On Feb 6, 11:38=A0am, Stephane CHAZELAS <stephane_chaze...@yahoo.fr>
wrote:
> 2011-02-5, 12:58(-08), bjlockie:
>
> > I want to delete the end of every line from the last - onwards.
> > Can I pattern match $- and then dw using vim?
>
> :%s/-[^-]*$//
>
> or
>
> :%s/\(.*\)-.*/\1/
>
> or (vim specific):
>
> :%norm $F-D
>
> or:
>
> :%s/.*\zs-.*//
>
> --
> Stephane
Great, thanks.
|
|
0
|
|
|
|
Reply
|
bjlockie
|
2/6/2011 10:23:36 PM
|
|