split a string

Hi

I have a script that loops though lines of a file and reads each line in to a variable ($LINE).

I want to look at the line and split it into it's constituent parts.

e.g. a line might be "This is a string"
I want to then have variables set to each element thus:
A=This
B=is
C=a
D=string

I'm guessing it should be simple but cannot figure it out.

can you please elaborate a bit more, maybe with some sample input and output.
And will the no. of word be fixed in the string

while read a b c d e f
do
    echo "a = $a"
    echo "b = $b"
    echo "c = $c"
    echo "d = $d"
    echo "e = $e"
    echo "f = $f"
done < myfile

Add as many variables as the largest possible number of words in a line. Otherwise, consider awk which does all this automatically.

whether you need awk depends on what you want to after the assignment. If you want the variable outside the awk statement maybe using awk may not be very helpful. But, in situations , where you require processing data, this is seldom the case---you can do everything you want inside awk.
awk '{for(i=1;i<=NF;++i) { print "Field " i " is "$i} print ""}' file_name for example prints out all fields, in all lines in the file