Le dimanche 08 mars 2015 à 06:05, meino.cra...@gmx.de a écrit: > Hi, > > hopefully this can be done with vim in some way: > (using Linux) > > I have an file (html) which contains lines containing lines > like this one > (some stuff)1741_word_anotherword(some stuff) > > (pattern: .*<number>_<text>.*) > > I another file I have only a list of numbers, which may or may not > listed in the first file. A certain sorting may or may not be present. > > I want to delete all lines from the first file, which are listed in > the second file. > > Is that possible with vim?
This little code should do what you want: for l in readfile("/path/to/your_second_file") exe "silent g/[^[:alnum:]]" . matchstr(l, '\d\+') . "[^[:alnum:]]/delete" endfor Put that in a vim script, while in the buffer containing the first file, source it with: :source /path/to/the/script Best, Paul -- -- 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 subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.