Deleting the last X characters of each line in vi


Delete anything past the 11th character on each line:

:%s/\(^.\{11\}\).*/\1/

It matches the whole line, but saves the first 11 characters, and then replaces the whole line with those 11 characters.

12/19/2011