vim Trick of the Day

In: Computers|Cool Links|Linux Tips|Programming

14 Nov 2007

:g/nbsp/d

That command sets up a “range” of all lines (hence the g for global) that match “nbsp”, and runs the command “d” (delete) on them.

I’m working with a file that was converted by a script from HTML, but had some carryovers that were whole unnecessary lines… No lines with ‘desirable’ content had the nbsp in them, just the junk ones. So we delete them all.

Kudos to this site for the inspiration.

Related posts:

  1. vim tricks
  2. Getting Familiar with the CLI
  3. Bans for Fun & Profit
  4. Digital Photo Recovery
  5. Web Design

Comment Form

On Other Sites

  • i5junkies: Thanks for this posting. It helped me fix the problem and running. GREAT post!!! [...]
  • emeka: i accidentally unscred all the screws and flipped my laptop now i dont know which screw goes where p [...]
  • Erik: Hey Matt! I came across your blog after seeing you had posted a link to our older website. I know t [...]
  • mot: haha - thats all i could say... thanks [...]
  • Motorola Phones - The RadioReference.com Forums: [...] Have a look at this page: Direct Talk Compatible Phones | Matt's Blog [...] [...]