how to replace spaces with tabs

This tip is for Windoze notepad users — clearly it’s trivial to replace spaces with tabs using sed or perl in linux. But notepad — one of the simplest and most useful Windows utilities from day one — does not understand regular expressions. And typing the tab key moves the cursor to the next dialog control, rather than entering a tab character at the cursor position. Sad!

The solution is to download notepadre by Ben Hanson. This is a nifty notepad clone with a few extra goodies, the main one being support for regular expressions (’re’). So not only can you replace spaces with tabs, but you can perform all sorts of amazing feats of pattern replacement limited only by your imagination.

I put a one-line batch file called np.cmd in my PC’s PATH which starts notepadre with the (optionally) specified filename:

start "" notepadre %1 %2

And he gives you the source code for free — thanks Ben!

One Response to “how to replace spaces with tabs”

  1. Ben Hanson Says:

    You are most welcome! :-)

Leave a Reply