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 > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 11-26-2008
CarlosNC CarlosNC is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 6
Assuming the number of columns is consistent throughout, and in this case is 1 or 2, an awk script might look like:
Code:
awk -F, '
NF == 2 {x=$1; print; next}
NF == 1 {print x","$1}
' infile > outfile
Cheers