It depends upon what you mean by split. If you want to iterate over words in a line, which is in a variable, you can just iterate. For example, let's say the variable line
is this is a line
. Then you can do this:
for word in $line; do echo $word; done
This will print:
this
is
a
line
for .. in $var
splits $var
using the values in $IFS
, the default value of which means "split blanks and newlines".
If you want to read lines from user or a file, you can do something like:
cat $filename | while read line
do
echo "Processing new line" >/dev/tty
for word in $line
do
echo $word
done
done
For anything else, you need to be more explicit and define your question in more detail.
Note: Edited to remove bashism, but I still kept cat $filename | ...
because I like it more than redirection.