Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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".

share|improve this question
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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