| Home page of Eric Pement | Home > awk.htm |
|
|
The awk programming languageawk is a programming language that gets its name from the 3 people
who invented it (Aho, Weinberger, and Kernighan). Because it was
developed on a Unix operating system, its name is usually printed in
lower-case ("awk") instead of capitalized ("Awk"). awk is distributed
as free software, meaning that you don't have to pay anything for it
and you can get the source code to
build awk yourself It's not an "I can do anything" programming language like C++ or VisualBasic, although it can do a lot. awk excels at handling text and data files, the kind that are created in Notepad or (for example) HTML files. You wouldn't use awk to modify a Microsoft Word document or an Excel spreadsheet. However, if you take the Word document and Save As "Text Only" or if you take the Excel spreadsheet and Save As tab-delimited (*.txt) or comma-delimited (*.csv) output files, then awk could do a good job at handling them. I like awk because it's concise. The shortest awk program that does anything useful is just 1 character:
On a DOS/Windows machine, this converts Unix line endings (LF) to standard DOS line endings (CR,LF). awk programs are often called "scripts" because they don't require an intermediate stage of compiling the progam into an executable form like an *.EXE file. In fact, awk programs are almost never compiled into *.EXE files (although I think it's possible to do this). Thus, many people refer to awk as a "scripting language" instead of a "programming language." This doesn't mean that you couldn't run an awk program from an icon on the Windows desktop. It means that instead of creating a shortcut to something like "mywidget.exe", you'd create a shortcut to "awk -f mywidget.awk somefile.txt" when Windows prompts you for the Command Line. Some awk thingies I've written
Tutorials
Discussion forums, newsgroups
|
These pages created with
First Page,
GNU Emacs,
htmlpp, and Servant Salamander. Icons courtesy of
Qbullets
. |
|