title: Bash: Split text-file into words with non-alphanumeric characters as delimiters
body: <p>Lets say "<em>textfile</em>" contains the following:</p>
  
  <pre><code>lorem$ipsum-is9simply the.dummy text%of-printing
  </code></pre>
  
  <p>and that you want to print each word on a separate line. <strong><em>However</em></strong>, words should be defined not only by spaces, but by all non-alphanumeric characters. So the results should look like:</p>
  
  <pre><code> lorem
   ipsum  
   is9simply  
   the  
   dummy  
   text  
   of  
   printing
  </code></pre>
  
  <p><strong>How can I accomplish this using the Bash shell?</strong></p>
  
  <hr>
  
  <p><br>
  Some notes:  </p>
  
  <ul>
  <li><p><em>This is not a homework question.</em>   </p></li>
  <li><p><em>The simpler case when the words should be determined only by spaces, is easy. Just writing</em>:</p>
  
  <pre><code>for i in `cat textfile`; do echo $i; done;
  </code></pre>
  
  <p><em>will do the trick, and return:</em></p>
  
  <pre><code> lorem$ipsum-is9simply
   the.dummy
   text%of-printing
  </code></pre>
  
  <p><em>For splitting words by non-alphanumeric characters I have seen solutions that use the IFS environmental variable (links below), but I would like to avoid using IFS for two reasons: 1) it would require (I think) setting the IFS to a long list of non-alphanumeric characters. 2) I find it kind of ugly.</em></p></li>
  <li><p><em>Here are the two related Q&amp;As I found</em><br>
  <a href="https://stackoverflow.com/questions/918886/split-string-based-on-delimiter-in-bash">How do I split a string on a delimiter in Bash?</a><br>
  <a href="https://stackoverflow.com/questions/1975849/split-line-into-words-in-bash">How to split a line into words separated by one or more spaces in bash?</a></p></li>
  </ul>