What is the Vi editor regex for this? -


i have lot of columns in table. want replace in query:

select count(distinct a), count(distinct b), count(distinct c), count(distinct d) table_name; 

to reflect aliases:

select count(distinct a) a, count(distinct b) b, count(distinct c) c, count(distinct d) d table_name; 

try this:

s/\vdistinct\s(.{1})\)/distinct \1) \1/g 

you gotta put \v @ beginning use groups.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -