Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!vsi1!wyse!bob From: bob@wyse.wyse.com (Bob McGowen Wyse Technology Training) Newsgroups: comp.unix.questions Subject: Re: extracting "rest of line" in AWK Keywords: awk Message-ID: <2409@wyse.wyse.com> Date: 6 Sep 89 21:44:25 GMT References: <3368@blake.acs.washington.edu> <4831@portia.Stanford.EDU> Sender: news@wyse.wyse.com Reply-To: bob@wyse.UUCP (Bob McGowen Wyse Technology Training) Distribution: na Organization: Wyse Technology Lines: 28 In article <4831@portia.Stanford.EDU> karish@forel.stanford.edu (Chuck Karish) writes: ---deleted--- >>and I want to do a {print $3} to get the "This is a Graph Heading" part, >>but this obviously dosen't work. Is there a way to do this? > >{for (num = 3; num <= NF; num++) {printf "%s ", $num}} >{printf "\n"} Or: awk -F\" '{print $2}' which sets the field separator to " and then prints the second field, which is between the two quotes. If you need the quotes output then the print could be: print "\""$2"\"" This will guarantee that everything between the quotes will be printed, while anything that may follow the second quote will be ignored. Also, no assumptions are made about the number of leading fields so modification of the data file will be less likely to require changing of the the awk script. Bob McGowan (standard disclaimer, these are my own ...) Customer Education, Wyse Technology, San Jose, CA ..!uunet!wyse!bob bob@wyse.com