I have a text with 9 columns opened in the vi-editor and I like to replace the tab characters in the 9th column (the last one) with a comma, followed by a space. So far I came up with this;
'2,$s#\(^.\{8\}\)\\t#\1\(\,\)#'
but that doesn’t seem to match anything… It could be that I escaped something too much, but also I don’t know if you need to specify the column delimiter (in this case also a tab).
Any help on this one would be greatly appreciated.
This replaces (
s):^– start of the line\(start of (group 1)\%(start of inner group\t?0 or more Tabs (to account for the lack of a Tab at the start of the line)[^\t]\+followed by 1 ore more non-Tabs\)end of inner group\{8\}the above inner group repeated 8 times\)end of (group 1)\tfollowed by a Tab\(.*\)and whatever else (group 2)$until the end of the linewith:
\1– (group 1) (everything up until the 8th Tab),– a comma and a space\2– (group 2) (everything from the 8th Tab until the end of the line)in the whole buffer (
%).