Re: VIM script replacement question

2006-05-25 Thread Alan G Isaac
On Thu, 25 May 2006, Nikolaos A. Patsopoulos apparently wrote: In detail: 1.I want in front of the number in the first column to add # , then change line after the value 2. change line after 3rd column 3. change line after 5th column 4. repeat all three steps

Re: VIM script replacement question

2006-05-25 Thread Nikolaos A. Patsopoulos
Alan G Isaac wrote: On Thu, 25 May 2006, Nikolaos A. Patsopoulos apparently wrote: In detail: 1.I want in front of the number in the first column to add # , then change line after the value 2. change line after 3rd column 3. change line after 5th column 4. repeat all three steps

Re[2]: VIM script replacement question

2006-05-25 Thread Alan G Isaac
On Thu, 25 May 2006, Nikolaos A. Patsopoulos apparently wrote: The replacement didn't occur to the whole file. You must have forgotten the '%'. hth, Alan Isaac

Re: VIM script replacement question

2006-05-25 Thread Nikolaos A. Patsopoulos
Alan G Isaac wrote: On Thu, 25 May 2006, Nikolaos A. Patsopoulos apparently wrote: The replacement didn't occur to the whole file. You must have forgotten the '%'. hth, Alan Isaac No, I used %. Got them same problem with Tim's code :(

Re[2]: VIM script replacement question

2006-05-25 Thread Alan G Isaac
On Thu, 25 May 2006, Nikolaos A. Patsopoulos apparently wrote: No, I used %. Got them same problem with Tim's code Something is not right ... Try using :g/./s/ instead of :%s/ and see what happens. hth, Alan Isaac

Re: VIM script replacement question

2006-05-25 Thread Nikolaos A. Patsopoulos
Alan G Isaac wrote: On Thu, 25 May 2006, Nikolaos A. Patsopoulos apparently wrote: No, I used %. Got them same problem with Tim's code Something is not right ... Try using :g/./s/ instead of :%s/ and see what happens. hth, Alan Isaac Works great! Million thanks! Nikos

Re: VIM script replacement question

2006-05-25 Thread Nikolaos A. Patsopoulos
Alan G Isaac wrote: On Thu, 25 May 2006, Nikolaos A. Patsopoulos apparently wrote: No, I used %. Got them same problem with Tim's code Something is not right ... Try using :g/./s/ instead of :%s/ and see what happens. hth, Alan Isaac One last question: I get this: #3 00

Re: VIM script replacement question

2006-05-25 Thread Tim Chase
I get this: #3 00 00 #4 11 10 #5 11 00 How I can put spaces between numbers in same rows? Looks like you omitted spaces between the \2 and \3 and between the \4 and \5 in Alan's solution (or my 2nd one that broke out each piece individually) The final replacement should read /#\1\r\2

Re[2]: VIM script replacement question

2006-05-25 Thread Alan G Isaac
On Thu, 25 May 2006, Nikolaos A. Patsopoulos apparently wrote: 00 must become 0 0 The original replacement I sent had these spaces in it: :g/./s/^\(\d\+\)\s\+\([01]\)\s\+\([01]\)\s\+\([01]\)\s\+\([01]\)\s*/#\1\r\2 \3\r\4 \5 Look after \2 and after \4 hth, Alan Isaac

Re: VIM script replacement question

2006-05-25 Thread Nikolaos A. Patsopoulos
Alan G Isaac wrote: On Thu, 25 May 2006, Nikolaos A. Patsopoulos apparently wrote: 00 must become 0 0 The original replacement I sent had these spaces in it: :g/./s/^\(\d\+\)\s\+\([01]\)\s\+\([01]\)\s\+\([01]\)\s\+\([01]\)\s*/#\1\r\2 \3\r\4 \5 Look after \2 and after \4 hth, Alan

Re: VIM script replacement question

2006-05-25 Thread mzyzik
Nikos, The one line :%s way that was posted before is the truly elegant way of solving this problem. However, I found that macros are especially appropriate in this case. I was able to execute the whole task in 15 seconds by recording a macro for the first line, and then playing it back 26 times.