Re: Replace spaces with underscore after some pattern in line

2023-09-28 Thread steve
Hi, I hope I won't say a stupidity… Le 28-09-2023, à 14:18:22 +0800, wenxin Wang a écrit : :%s/\(XXX[^ ]*\) /\1_/g I am a newbie to vim, but would like to learn it . Please tell me what exactly does 1_ do in your command ? I knew that you wanted to substitute by underscore, but why 1 was the

Re: Replace spaces with underscore after some pattern in line

2023-09-27 Thread Arun
On Wed, Sep 27, 2023 at 4:50 AM 'c.willis111' via vim_use < vim_use@googlegroups.com> wrote: > > -- Original Message -- > From: "Igor" > To: "vim_use" > Sent: Wednesday, 27 Sep, 2023 At 12:09 > Subject: Replace spaces with underscor

Re: Replace spaces with underscore after some pattern in line

2023-09-27 Thread wenxin Wang
On Wed, 27 Sep 2023, "'c.willis111' via vim_use" wrote: -- Hi to my slight surprise this works: :%s/\(XXX[^ ]*\) /\1_/g The reason I had doubts is that the successive replacements start at the beginning of the earlier replacement. (Sorry about layout. I'm not into this add at the end b

Re: Replace spaces with underscore after some pattern in line

2023-09-27 Thread Igor
All of the solutions work great. Thanks to you all. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscr

Re: Replace spaces with underscore after some pattern in line

2023-09-27 Thread Christian Brabandt
On Mi, 27 Sep 2023, Igor wrote: > How to replace all of the spaces in each line after XXX string? > > Input sample data: > aa bb XXX a bbb > ee XXX aaa ddd > ddd ee XXX aaa bbb eee > > Output sample data: > aa bb XXX_a

Re: Replace spaces with underscore after some pattern in line

2023-09-27 Thread Mikhail Velikikh
x27; via vim_use < vim_use@googlegroups.com> wrote: > > > > -- Original Message -- > From: "Igor" > To: "vim_use" > Sent: Wednesday, 27 Sep, 2023 At 12:09 > Subject: Replace spaces with underscore after some pattern in line > > How to replace all

Re: Replace spaces with underscore after some pattern in line

2023-09-27 Thread 'c.willis111' via vim_use
-- Original Message -- From: "c.willis111" To: vim_use@googlegroups.com Sent: Wednesday, 27 Sep, 2023 At 12:49 Subject: Re: Replace spaces with underscore after some pattern in line -- Original Message -- From: "Igor" To: "vim_use" Sent: We

Re: Replace spaces with underscore after some pattern in line

2023-09-27 Thread 'c.willis111' via vim_use
-- Original Message -- From: "Igor" To: "vim_use" Sent: Wednesday, 27 Sep, 2023 At 12:09 Subject: Replace spaces with underscore after some pattern in line How to replace all of the spaces in each line after XXX string? Input sample data: aa bb cc

Replace spaces with underscore after some pattern in line

2023-09-27 Thread Igor
How to replace all of the spaces in each line after XXX string? Input sample data: aa bb XXX a bbb ee XXX aaa ddd ddd ee XXX aaa bbb eee Output sample data: aa bb XXX_a_bbb ee XXX_aaa___dd