210 likes | 345 Vues
UNI Kassel VERSITÄT. AWK. Fatemeh Mohsenipour. Contents. What is AWK? AWK Versions Typical applications of AWK AWK features AWK Advantages AWK Disadvantages Structure of an AWK Program Song exampel Inroduce creaters of AWK Interview summery References. What is AWK?.
E N D
UNIKassel VERSITÄT AWK Fatemeh Mohsenipour
Contents • What is AWK? • AWK Versions • Typical applications of AWK • AWK features • AWK Advantages • AWK Disadvantages • Structure of an AWK Program • Song exampel • Inroduce creaters of AWK • Interview summery • References
What is AWK? • Is a script language • Originally designed/implemented in 1977 in Bell laboratory • A Pattern scanning and processing language • The language looks a little like C
AWK Versions • oawk first version ab 1977 (old AWK) • nawk – extended version from 1985 (new AWK) • mawk – extended version by Michael Brennan • gawk – GNU-AWK (faster, better Error messages)
AWK features • Interpreter • Stream-oriented editor • As a filter program used in pipelines • Automatic memory management • No variable declaration • Few data type • Automatic data type conversion between number and string • Allows fast, interactive development
Typical applications of AWK • Generate reports • Reformatting texts • Creating small databases. • Validate data • Look for entries with certain properties
AWK Advantages • Is eay to learn • Let to experiment with algorithms • Can be used for rapid prototyping • Is small and available every where • It is interpreted language
AWK Disadvantages • Not sutible to writing big programs • Relatively slow for large amounts of data • No variables declaration • Sequential file access • Syntax error messages rather Spartan
Structure of an AWK Program BEGIN pattern {action} pattern {action} . . . pattern { action} END
Program example BEGIN { for(i = 99; i >= 0; i--) { print ubottle(i), "on the wall,", lbottle(i) "." print action(i), lbottle(inext(i)), "on the wall." print } } function ubottle(n) { return sprintf("%s bottle%s of beer", n ? n : "No more", n - 1 ? "s" : "") } function lbottle(n) { return sprintf("%s bottle%s of beer", n ? n : "no more", n - 1 ? "s" : "") } function action(n) { return sprintf("%s", n ? "Take one down and pass it around," : \ "Go to the store and buy some more,") } function inext(n) { return n ? n - 1 : 99 }
Alfred Aho Birth : August 9, 1941 in, Canada Education: Ph.D. in Electrical Engineering/Computer Science from Princeton University Current Position : Professorof Computer Science at Columbia University. Writings: AWK programming language,Compilers: Principles, Techniques, and Tools , Unix tools egrep and fgrep, Aho–Corasick string matching algorithm [1]
Brain Kerningham • Birth : born January 1942 in Toronto • Education: Ph.D. in Electrical Engineering/Computer Science from Princeton University • Current Position : Professor of Computer Science at Princeton University. • Writings: • Software Tools in Pascal • The C Programming Language • The Elements of Programming Style • The Unix Programming Environment • The AWK Programming Language • AMPL: A Modeling Language for [2]
Peter Weinberger • Education: PhD in mathematics from the University of California, Berkeley • Current Position: as computer scientist who works at Google. • Writings:The AWK Programming Language [3]
Interview • Importance of understanding user’s requirement by developer • Attract more users • Better software design • Software survive
Interview • Importance of formalizing the semantics and ideas of language • Tedious • Expensive
Interview • Importance of having tools and enough science for producing software and role of developers taste • Sound principles • Personal taste
Interview • which features should be measured during development of code base? • Correctness • Keeping documentation and comment with code
Interview • Features of good manual for new language • Let find things easy • Crystal clear examples
Interview • How choice of programming effect security • Logical errors • Buffer overflow
refrences 1- Masterminds of Programming, O‘Reilly 2009 2- http://www.vectorsite.net/tsawk_2.html#m1 3-http://www.grymoire.com/Unix/Awk.html#uh-0 4-http://www.awktutorial.com/ 5-http://www.computerworld.com.au/article/216844/a- z_programming_languages_awk/?pp=2 [1] http://www.columbia.edu/cu/news/03/05/images/alfredAho.jpg [3] http://www.chessbase.com/images2/2003/weinberger05.jpg [2]http://www.at-mix.de/images/glossar/kernighan-brian.jpg