Joseph_C_McDonald@cup.portal.com (11/27/88)
What is AWK? I have heard of it before, and have an inkling that it is some sort of language but that is about as far I go. Can someone please explain it to me? Thanks -=Joseph=-
jerry@starfish.Convergent.COM (Gerald Hawkins) (11/28/88)
From article <11817@cup.portal.com>, by Joseph_C_McDonald@cup.portal.com: > What is AWK? I have heard of it before, and have an inkling that it is > some sort of language but that is about as far I go. Can someone please > explain it to me? > Thanks > -=Joseph=- - - There are two answers. The first :-) You must be considering interviewing with my company. One of the questions I ask when somebody claims to be a real whiz with Unix, is 'What is the difference between GREP and AWK?' (Few can answer). The real answer is that AWK is a language which can be used like a command. I've only seen it on Unix systems, but it probably is on PCs and others, too. Awk's main purpose is to strip information out of formatted files. For example, if a file exists which is a series of lines of text, and each line contains a varying number of fields (or the same number) of varying lengths (or all the same, it doesn't matter) and you wish only to sum all the figures from the second field (delimited by spaces, tabs, commas, etc), that operation takes about 2 lines of AWK code. The first time you use it, it will seem very obscure. The second time, it becomes very simple. Back to the first answer. The difference is, GREP is a command, AWK is a language. GREP reports back an entire record from a file for further use by the programmer, based on a comparison to a search string. AWK will perform text or mathematical operation to the values in specified fields of records from a file, based on a search string or other inputs. Either AWK or GREP will search an entire file with a single command, ie, no DO-WHILE loop or anything resembling is required. Rainy Days and Automatic Weapons Fire Alway Get Me Down. These opinions are mine. Jerry. (jerry@starfish.convergent.COM) -----