The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 10-06-2008
matrixmadhan matrixmadhan is online now Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,932
Quote:
Originally Posted by danmero View Post
This is a very "first time question"
The basic concept should be:
Code:
while read col1 col2
do 
  echo $col1 >> output.file
  echo $col2 >> output.file
done < data.file
For solutions you can use the search tab on this forum... or Google for tutorials for your shell.
this is much better, no need to open and close files multiple times

Code:
while read col1 col2
do 
  echo $col1 
  echo $col2 
done < data.file >> output.file