[olug] VIM help

Mike Hostetler thehaas at binary.net
Mon Feb 19 20:08:28 UTC 2001


For some reason, vim doesn't understand "\n" in it's regular expressions.
I dunno why . . the help says it is coming soon . . . 

So cut and paste the stuff between the "========================" into
~/.vimrc, and then restart vim (or gvim) and type ":RL <str>".  It will
work.  But make sure you have a backup of the file, in case it really
hoses it up . . . 

Oh, and vim scripting is kinda weird, but also kinda cool . . .

- mikeh

========================
function! RemoveLine(string)
 let cmd = "/".a:string
 let eof = line("$")
 exec ":1"
 let begof = line(".")
 let i = begof
 while (i <= eof)
   exec cmd
   exec ":delete"
   let i = line(".")
   let eof = line("$")
   if (i == begof)
	   break
   endif
 endwhile
endfunction

command! -nargs=1 RL call RemoveLine(<f-args>)
========================

On Mon, Feb 19, 2001 at 11:00:43AM -0600, Rado Bonk wrote:
> Hello Linux users,
> I am working with big ASCII files. There is just one column of data in
> each file. I need to delete lines with the specific string. If I use in
> VIM:
> :%s/string// or :%s/^string//
> 
> the string is deletd but the line (empty) is still in the file. I need to
> delete the entire line. Something like "\n" would help. I use VIM for
> ASCII file editing.
> Sincerely,
> 		Rado
> 
> Rado Bonk
> Geography and Geology
> UNO, Omaha, NE 68182-0199
> rado at cosmos.unomaha.edu
> http://rbonk.host.sk
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: olug-unsubscribe at bstc.net
> For additional commands, e-mail: olug-help at bstc.net

---------------------------------------------------------------------
To unsubscribe, e-mail: olug-unsubscribe at bstc.net
For additional commands, e-mail: olug-help at bstc.net



More information about the OLUG mailing list