title: linux - telnet - script with expect
body: <p>I was writing an expect-script which communicate with a server via telnet, but right now i need to evaluate the reply from server.</p>
  
  <p>Usage:</p>
  
  <pre><code>./edit.expect
  </code></pre>
  
  <p>EXPECT script:</p>
  
  <pre><code>#!/usr/bin/expect&lt;br&gt;
  spawn telnet ip port
  expect "HUH?"
  send "login testuser pass\r"
  expect "good"
  send "select 1\r"
  expect "good"
  send "me\r"
  expect "nick=testuser id=ID group=testgroup login=testuser"
  send "edit id=ID group=3\r"
  expect "good"
  send "quit\r"
  </code></pre>
  
  <p>If i send the command "me" i get a reply from the server which i need to evaluate.
  The reply from server looks like this example... "nick=NICK id=ID group=GROUP login=LOGIN".</p>
  
  <p>How do i extract the id of the reply and use it in a send-command?</p>
  
  <p>I hope you could help me with that. Thanks a lot!</p>