SlideServe
Menu
Préférences
© SlideServe · v2026

Understanding AWK: A Powerful Pattern Scanning Language for Data Processing

milos avatar
21 diapositives · 384 Views · Jul 20, 2014

AWK is a versatile scripting language designed for pattern scanning and processing, initially created in 1977 at Bell Laboratories. This document explores various aspects of AWK, including its versions (old AWK, new AWK, mawk, gawk), typical applications such as report generation and data validation, along with its features, advantages, and disadvantages. The structure of an AWK program is outlined, including a song example showcasing its syntax. Additionally, insights into the creators of AWK, Alfred Aho, Brian Kernighan, and Peter Weinberger, along with their contributions, are provided.

Understanding AWK: A Powerful Pattern Scanning Language for Data Processing - slide 1
01 / 21Understanding AWK: A Powerful Pattern Scanning Language for Data Processing
1 / 17

Télécharger la présentation

Understanding AWK: A Powerful Pattern Scanning Language for Data Processing
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. UNIKassel VERSITÄT AWK Fatemeh Mohsenipour

  2. 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

  3. 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

  4. 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)

  5. 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

  6. Typical applications of AWK • Generate reports • Reformatting texts • Creating small databases. • Validate data • Look for entries with certain properties

  7. 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

  8. 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

  9. Structure of an AWK Program BEGIN pattern {action} pattern {action} . . . pattern { action} END

  10. 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 }

  11. 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]

  12. 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]

  13. 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]

  14. Interview • Importance of understanding user’s requirement by developer • Attract more users • Better software design • Software survive

  15. Interview • Importance of formalizing the semantics and ideas of language • Tedious • Expensive

  16. Interview • Importance of having tools and enough science for producing software and role of developers taste • Sound principles • Personal taste

  17. Interview • which features should be measured during development of code base? • Correctness • Keeping documentation and comment with code

  18. Interview • Features of good manual for new language • Let find things easy • Crystal clear examples

  19. Interview • How choice of programming effect security • Logical errors • Buffer overflow

  20. 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

  21. THANK YOU!