Search and replace /foo/"/ prints literal " instead of register's content

خرید بک لینک

I'm editing a large .csv file with pre-formatted data which I need to format further.

The data looks something like this (simplified to only include stuff relevant to my issue):
40;;10:00-20:00;15:00-17:00<br> 41;09:00-15:00;12:00-19:00;12:00-20:00

The first number is an id that I want to use at the start of every line, creating one new line for every semicolon separated cell, like this:
40; 40;10:00-20:00 40;15:00-17:00

.. and so on for each id.

I've been trying this command to kick things off, cursor at the start of a row:
"nyw :s/;/r<c-r>n;/g

Yank word to register n, search for each ; in the row, replace it with a newline, the yanked word and a semicolon.

Expected output for example row with id 40:
40<br> 40;<br> 40;10:00-20:00<br> 40;15:00-17:00

Actual output:
40 <br> <c-r>n;<br> <c-r>n;10:00-20:00<br> <c-r>n;15:00-17:00<br>

If I use "np I get the expected 40 pasted.

So the search and replace is printing the literal text rather than the command. What am I doing wrong? Can my command be fixed and/or are there other useful methods I should consider to solve my formatting?

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 181 تاريخ: سه شنبه 1 تير 1395 ساعت: 19:19

صفحه بندی