I've got the following sample HTML code:
<html><body>
<table class="foo">
<tr><td>1</td></tr>
<tr><td>2</td></tr>
<tr><td>3</td></tr>
<tr><td>4</td></tr>
</table>
<table class="bar">
<tr><td>1</td></tr>
<tr><td>2</td></tr>
<tr><td>3</td></tr>
<tr><td>4</td></tr>
</table>
</body></html>
and I'd like to sort the second table in reverse.
However whenever I run this command at the beginning of the file:
:/<table class=.bar\_.\{-}\zs<tr/,/table>/sort! n /.\{-}<td/
I've got the user interactive warning saying:
Backwards range given, OK to swap (y/n)?
If I select n
- nothing happens, when I select y
, then the results are not what I would expect.
Although it works as expected, when I run command by having cursor after the 1st table.
How I can perform the above sorting operation non-interactively without being worried where my cursor is?