0

How do you remove the last few characters from all lines in a text file?

Example:

23193 123252 1
1238 123 1
34356363 11238080123 1

Should become:

23193 123252
1238 123
34356363 11238080123

I'm using the evil interface in Spacemacs.

  • I ended up executing :%s/.$// twice to remove the last two characters. Is there a better way to do this? – Logan S. Jan 11 '18 at 21:11
  • 1
    ..$ will match the last 2 characters in each line. – Juancho Jan 11 '18 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.