Tim Chase <v...@tim.thechases.com> [09-09-05 23:55]: > > > is it possible and if 'yes' to do the following: > > > > In a text of paragraphs, there are paragraphs containing > > a certain keyword. > > I want to delete all lines of all paragraphs containing > > the keyword except the lines containing the keyword. > > And I want to delete all paragraphs containing no keyword > > completly. > > And I want to delete all paragraphs consisting only lines > > containing the keyword. > > With some constraints on your input, yes. > > Constraint: All lines of a paragraph begin at the start-of-line > (no indented lines) > > " indent those paragraphs containing "backup" > :sil! g/backup/'{,'}> > > " delete those lines/paragraphs that didn't get marked > :g/^\S/d > > " purge out those lines containing the keyword > :g/backup/d > > " unindent the lines back to their original > :%s/^\s\+ > > " clean up any stray blank lines: > :g/^\s*$/d > > > Your source text adheres to the above constraint, so hopefully > this works for you. This is a variant of the "decorate, sort, > undecorate" pattern -- in this case a "decorate, process, > undecorate". > > -tim
Hi Tim, thank you very much for your help. ! :) best regards, mcc -- Please don't send me any Word- or Powerpoint-Attachments unless it's absolutely neccessary. - Send simply Text. See http://www.gnu.org/philosophy/no-word-attachments.html In a world without fences and walls nobody needs gates and windows. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---