I has the next text:
I need to remove all whitespaces in the beginning of the lines. Every line has different count of whitespaces. The result must be like this:
IMHO the standard way is:
^\s-+as regular expression and RET. (See explanation below.)
query-replace-regexpin the minibuffer.
Explanation of the regular expression:
You can use regex inside emacs (C-M-s). Check here emacs regex. By using regex you can write a rule that matches all the blanks that are at the beginning.
Another thing you can do: use M-x
align-regex, then use SPC as input to this command (i.e. align on space), then use rectangle-editing commands: C-x r k for example to delete rectangle before the lines.
This is not terribly efficient, but it's how I do it because I use both commands very often and they are, sort of, automatic for me (muscle memory, or w/e you call it).
Another way is just to mark the region and call delete-whitespace-rectangle!