title: ip rule: deleting all rules from table
body: <p>I am working on a bash script that use de <code>ip rule...</code> command to add and remove some rules. But I am having problems removing them. For example <code>ip rule show</code> output looks like this:</p>
  
  <pre><code>0:  from all lookup local 
  32764:  from all fwmark 0x3022 lookup 12322 
  32765:  from 10.10.10.1 lookup 12322 
  32766:  from all lookup main 
  32767:  from all lookup default
  </code></pre>
  
  <p>All the info I have is the table id (12322) and I need to remove all the rules that lookup that table.</p>
  
  <p>I tried these commands: <code>ip rule del table 12322</code> and <code>ip rule del lookup 12322</code>, but both commands remove always the first rule, and not the first rule that lookup 12322, I mean the first rule <code>from all lookup local</code>. If I run any of those commands 5 times I end up with no rules.</p>
  
  <p>How can I remove all the rules that <code>lookup 12322</code> in one command?</p>