The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: split a string
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 02-08-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,770
Code:
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.