Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here's a minimal example of what I'm trying to do. Start with:

[hundreds of lines like this]

End with:

[hundreds of lines like this]

I have gotten this far:

g/"\p*"/s/)/[what to put here?]

So it correctly identifies the string that I want to copy. What I'm not sure is how to tell it that I want it to paste that string at the end. I've tried using &, but that matches the ), not the "\p*".

share|improve this question
:%s/"\(.*\)")/"\1",\&\1)/ – Stéphane Chazelas Feb 5 '13 at 22:32
up vote 1 down vote accepted

could you just use a search and replace on every line?

:% s/"\([a-z]*\)"/"\1"\,\&\1/g
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.