title: Bash Sorting STDIN
body: <p>I want to write a bash script that sorts the input by rules in different files. The first rule is to write all chars or strings in file1. The second rule is to write all numbers in file2. The third rule is to write all alphanumerical strings in file3. All specials chars must be ignored. Because I am not familiar with bash I don t know how to realize this.</p>
  
  <p>Could someone help me?</p>
  
  <p>Thanks,
  Haniball</p>
  
  <p>Thanks for the answers,</p>
  
  <p>I wrote this script,</p>
  
  <pre><code>#!/bin/bash
  
  inp=0 echo "Which filename for strings?" 
  read strg 
  touch $strg
  echo "Which filename for nums?"
  read nums
  touch $nums
  echo "Which filename for alphanumerics?"
  read alphanums
  touch $alphanums
  while [ "$inp" != "quit" ]
  do
   echo "Input: "
   read inp
   echo $inp | grep -o '\&lt;[a-zA-Z]+&gt;' &gt; $strg
   echo $inp | grep -o '\&lt;[0-9]&gt;' &gt; $nums
   echo $inp | grep -o -E '\&lt;[0-9]{2,}&gt;' &gt; $nums
  done
  </code></pre>
  
  <p>After I ran it, it only writes string in the stringfile.</p>
  
  <p>Greetings, Haniball</p>