Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

"this")
"that")
[hundreds of lines like this]

End with:

"this",&this)
"that",&that)
[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
1  
:%s/"\(.*\)")/"\1",\&\1)/ –  Stéphane Chazelas Feb 5 '13 at 22:32

1 Answer 1

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

 
discard

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.