Let's say you have a properties file that looks like this:

prop1 = value1
longerprop = value2
reallylongpropthathasnomeaning = val3
shorterprop = val4

and you want to "beautify" it into this:

prop1                          = value1
longerprop                     = value2
reallylongpropthathasnomeaning = val3
shorterprop                    = val4

Recent versions of Emacs have a nice function called align-regexp that does exactly this. You select an area you want to align, enter a regular expression (in this case, "=") and it will align everything properly.

Is there a *nix or Windows command that will perform something like this? Maybe some awk, sed or perl trickery if a standalone command doesn't exist.

If there is no way to do it conveniently outside of Emacs, then I might have to write it myself ;-)

Reason why I ask this: I stumble often upon text that is structured like this, on various machines that don't have Emacs installed, and it would be nice if I could format text the way I want.

For more info, google "Emacs align regexp".

link|improve this question
feedback

1 Answer

Many tools will do this for you. Notepad++ has a plugin that will do this. Visual Studios does this.

Also, it never hurts to have cygwin & eMacs.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.