title: How to remove initial and final digits from strings using bash scripting
body: <p>Quite new to bash scripting so If I have a list usually text files each file specific for one country for example USA.txt client addresses with leading ZIP and ending P.O Box (Numbers are masked for privacy) :</p>
  
  <pre><code>38495newyork940
  454354irvine40404
  2333wathington4440
  32333california002929
  23234dallas4th93303 
  </code></pre>
  
  <p>I want to run USA.txt as an argument to a bash script that would remove the leading and final digits from each line. Please note that certain cities or states might have numbers within the names so I want to keep them.</p>
  
  <p>I tried to run it against sed commands but I can't combine the end result I just remove the leading or final numbers with commands like :</p>
  
  <p>for leading digits:</p>
  
  <pre><code>sed -r 's/^[0-9]+(.*[^0-9].*)$/\1/g'
  </code></pre>
  
  <p>and for ending digits:</p>
  
  <pre><code>sed "s/\([^0-9]\)[0-9]*\s*$/\1/"
  </code></pre>
  
  <p>I need the output like:</p>
  
  <pre><code>newyork
  irvine
  wathington
  california
  dallas4th
  </code></pre>
  
  <p>Thanks</p>