On Thu, Apr 05, 2007 at 10:10:03AM EDT, jas01 wrote: > > I have a huge file where I need to delete all lines except for a few I need. > I'm trying to do this in a single command. > > I know that: > > :v/Text/d > > will delete all lines except for ones containing 'Text.' I have no idea how > to put multiple strings so the command deletes everything except for 'Text' > and 'Text2' and 'Text3'. > > Please help!
Maybe you're using the wrong tool to begin with? If the file is really huge, you may find adopting a different strategy is preferable. If you're on linux or similar you might use a command-line tool such as: $ grep Text[1-3] huge_file > a_few_lines What this does is that it finds all the lines that contain at least one occurrence of Text1, Text2, or Text3 in ./huge_file and copies them to ./a_few.lines. Thanks, cga