Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!netnews.upenn.edu!msuinfo!news From: jpd@tardis.cl.msu.edu (Joe P. DeCello) Newsgroups: comp.unix.questions Subject: file manipulation (easy question I think - REWORDED) Keywords: awk sed Message-ID: <1991Jun18.014539.22085@msuinfo.cl.msu.edu> Date: 18 Jun 91 01:45:39 GMT Sender: news@msuinfo.cl.msu.edu Organization: Michigan State University, East Lansing Lines: 28 To rephrase my previous question: Suppose I have a file containing several lines of text. Each line is an entry for a database (or whatever) and let's say each line contains 8 fields. The fields are separated by colons. I would like to be able to output the first field of each line into a new file. I would like these fields to be on one line in the new file and separated by commas. The best response to my previous posting was this: awk '{printf "%s ", $1' < infile > outfile I changed this to : awk '{printf "%s, ", $1' < infile > outfile to get separation by commas, but now I need to break off the first field of each line from the infile at the colon. Thanks for those who have replied to the original question and to those who reply to this one. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Joseph P. DeCello III e-mail: jpd@cad.msu.edu Michigan State University phone: (517) 353-3027 Specialized Computing Support Services