How can I remove all but the first n characters of a every line in the file buffer?
What I tried
Mark region C-x r k #but this is cumbersome when the length of lines are very varied, and there are over 100 lines
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
You can do a
replace-regexp like this:
This will match lines with at least 15 characters, and replace with the 1st 15 (which are saved as a match group).
Did you mention that n=15?