title: TCL Expect: how to remove a trailing newline
body: <p>I am executing this expect script:</p>
  
  <pre><code>#!/usr/bin/expect
  
  #####config file content :: user1|server1
  
  set lx [exec awk {-F|} {/server1/ {print $1}} config]
  
  puts "Values is $lx of server1."
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>Values is user1
  of server1.
  </code></pre>
  
  <p>There is a trailing new line in <code>$lx</code> that i am unable to remove.
  I have tried :</p>
  
  <pre><code>set x [string trimright $lx \n]
  set x [string trimright $lx "\n"]
  set x [string trim $lx \n]
  </code></pre>
  
  <p>But there is always a <code>\n</code> left on the end of <code>$x</code>. How can this newline be removed? </p>