title: NodeJS reading a txt file, read specific line, then edit that line
body: <p>I have a file, "./uid/total.txt".</p>
  
  <p>I want to read its line "2" which is the total users.</p>
  
  <p>Then use that variable and then add 1 to it and rewrite the "./uid/total.txt"'s line "2" to the new amount.</p>
  
  <p>The code used is:</p>
  
  <pre><code>    client.addListener('message#', function (from, to, message) {
          if (message.length &lt; 1 || !(message[0] == '!')) {
              return;
          }
          message = message.slice(1);
          var params = message.split(/\s/);
          var user = from.toLowerCase()
          switch (params[0].toLowerCase()) {
          case 'register':
          get_line('./uid/total.txt', 2, (function(err, totals){
              if (err) {
                client.say(channel, 'error');
                return;
              }
              prevtotuser = totals;
            }));
          client.say(to, User + ' has registed now with a total number of '+totalnum+' users');
          break;
          if (switcher != null) {
            client.say(to, user+', command: !anon &lt;on/off&gt;')
          }
        }
      });
  </code></pre>