Read Line and sent as variable for each string

Hi ,

I want to read below output, lets called it output1.txt and each string for every line will be declare as a variables.

This is the input file

196    server_a    server_unix_2    FW
196    server_b    server_win_1    CD
196    server_c    server_win_2    CD
196    server_bd    server_unix_2    FW
196    server_bd    server_unix_2    CD
196    server_bd    server_unix_2    CD
196    server_bd    server_unix_2    CD

What i want to do is to read every line with each of the string for every line will be given a variable. Eg from line 1: $code is for 196, $client is for server_a , $name for server_unix_2, $time for FW.

This is because later on my script, i will send those variable to be use on another script. I have tried using while and read but all failed.

Have you tried this:

while read code client name time
do
   # do stuff with variables...
done < output1.txt

Thanks a lot Scrutinizer for the idea, its now working. I tested by sending to my email, below is the script:

while read code client name sched time
do
#printf "$client\t $code\t $name\t $time\t \n"
echo "$client\t $code\t $name\t $time\n" | mailx -s "Client $client : Name $name failed with code $code at $time" sqew\@abc.com

done < compare1

First i tried to print it, at line with #. Thanks :b: