Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mit-eddie!snorkelwacker.mit.edu!usc!wuarchive!m.cs.uiuc.edu!ux1.cso.uiuc.edu!mrcnext!heal From: heal@mrcnext.uiuc.edu (Loren E. Heal) Newsgroups: comp.unix.programmer Subject: Re: Awk question Message-ID: Date: 2 Mar 91 20:22:30 GMT References: <1991Mar2.040258.17967@casbah.acns.nwu.edu> Sender: usenet@ux1.cso.uiuc.edu (News) Distribution: usa Organization: University of Illinois at Urbana Lines: 23 navarra@casbah.acns.nwu.edu (John Navarra) writes: >My manual is not very helpful -- is there an awk function that specifies a >column number rather than a field number such that I could get a " " as an >answer if column # (say 16) is blank? Use $0[15] to get the 16th character. $0 means the whole line. You might also use sprintf() or substr(). From my man page: ... An input line is made up of fields separated by white space. (This default can be changed by using FS, vide infra.) The fields are denoted $1, $2, ... ; $0 refers to the entire line. ... --> substr(s, m, n) returns the n-character substring of s that begins at position m. The function sprintf(fmt, expr, expr, ...) formats the expressions according to the printf(3S) format given by fmt and returns the resulting string. -- Loren E. Heal : heal@mrcnext.cso.uiuc.edu, (UUCP)!uiucuxc!m.c.u.e!heal