Split lines in a file and store them in variables

Hi,

I have a file called files.txt which contains data like

There are multiple lines like the above in this file.

In .sh script, I would like to read this file, split each line, and store the variable of "qrs" and "wxyz" in separate variables.

Please let me know the code. Its very urgent.

Thanks,
Archana

 
while read line
do
   var1=`echo $line| nawk -F"\/" '{print $(NF-1)}'`
   var2=`echo $line | nawk -F"\/" '{print $(NF-3)}'`
   echo $var1
   echo $var2
done < files.txt

Input file :

 
$ cat files.txt
http://abc.xyz.com/ghi/klm/nop/qrs/tuv/wxyz/
http://abc.xyz.com/ghi/klm/nop/asdf/tuv/sfsd34/
http://abc.xyz.com/ghi/klm/nop/qr234s/tuv/sdf34/
http://abc.xyz.com/ghi/klm/nop/asdf/tuv/sdfr34/
http://abc.xyz.com/ghi/klm/nop/23sdf/tuv/sfs43/

output :

 
bash-3.00$ ./test.ksh 
wxyz
qrs
sfsd34
asdf
sdf34
qr234s
sdfr34
asdf
sfs43
23sdf

Confused with the above highlighted. Can you be more clear or better post the required output format.

This works for me when I remove 'n' from 'nawk' and '\' from nawk -F"\ /".

Thanks a lot !