The second pattern looks more like a perl pattern but not quite the right one. multiline searches in perl require a /m option on the search to more than one ^ and $. Also on the replace side ^ and $ are just literally the ^ and $ char's.
Switching to answer the question - 'how can I do this with some tool' in vim :%s/^\n$// does what you asked for. ^ and $ apply only on the search side meaning beginning and end of a line and and they don't match the line separator (for linux \n and the replacement is literally nothing // Of course if you have dos line termination or other weird stuff matching would have to include \r and \n in the approximate order say :%s/^[\n\r]*$// and to complicate things even more 'blank lines' in formatted text are often not ^$ but contain white space, which would lead to:%s/^\s*[\n\r]*\s*$// Rich Shepard wrote: > Large files have a mix of single and double line spacings. I want to > convert double spaced lines to single space lines but cannot find the > appropriate regex search and replace syntax. Looking in the emacs wiki and > other web sites suggested that C-q C-j C-q C-j + would do the job, but it > does not. Neither does (search) ^$^$ (replace) ^$. > > I thought this was a simple request but the answer is avoiding me. > > TIA, > > Rich > _______________________________________________ > PLUG mailing list > [email protected] > http://lists.pdxlinux.org/mailman/listinfo/plug > _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
