Sublime Forum

Multi-row find and replace?

#1

Hey guys. I have to update HTML tables that are generated automatically from a CSV doc. What I end up with is something like this, except with hundreds of rows:

<table>
<tr>
<td>a</td> 
<td>b</td>
<td>c</td>
<td>d</td>
</tr>

<tr>
<td>e</td> 
<td>f</td>
<td>g</td>
<td>h</td>
</tr>

</table>

Each has it’s own class, so it needs to look like this:

<tr>
<td class="W">a</td> 
<td class="X">b</td>
<td class="Y">c</td>
<td class="Z">d</td>
</tr>

<tr>
<td class="W">e</td> 
<td class="X">f</td>
<td class="Y">g</td>
<td class="Z">h</td>
</tr>

</table>

I know how to use right click + shift to select just the section block that would include all four class="" snippets, but I need a way to paste them down hundreds of rows. If I use right click + shift to create a four line cursor I can paste it, but I have to do that hundreds of times over and over. I guess my question is, there a way to subtract specific individual lines from a multi-row cursor? E.g. If I created a cursor that dragged all the way down 50 sections, could I subtract where the cursor has been added to the and the without subtracting it from the sections?

0 Likes

#2
  1. Search for “

  2. Select all

  3. press down

  4. adjust cursors to be right after “<td”

  5. type class="W"

  6. repeat from 3.

0 Likes