The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-23-2007
eltinator eltinator is offline
Registered User
 

Join Date: Jul 2007
Posts: 54
Storing space delimited line in var with loop?

I have a script that converts a file into an html table. This script works fine for a 1 column table. However, I'm trying to do this for a multi-column table. My input file will look something like this:

a b c
d e f
g h i

My script basically works by taking in each line and putting that value into an html tag using a while loop reading each line. Now I need to make the script read each value of each line. The number of columns will be set so I figured what I could do is just have some sort of loop that stores each value of a line into a variable and then use it to build my table. I'm just not sure how to do that.

Is there a way to get the first line and have say these variables set like this $1=a, $2=b, $3=c? Each line will always be space delimited. Any help would be much appreciated. Thanks!
Reply With Quote
Remove advertisements
!!
Forum Sponsor