The Shell (bash) is a command-line interface for invoking other programs on the Linux system. It is a also a powerful programming language for controlling complex job flows using pipelines and conditional/looping constructs. Combined with the GNU coreutils programs and perhaps a few simple filter programs written in Perl or Python, complex programs can be composed in just a few lines.
This session will provide a live demo showing how fairly complex systems can be built from the available primitive operations. For example, to count down the top ten words (Letterman-style) occurring in a file, say mydata.txt, you may type this command line:cat mydata.txt | sed -r -e 's/[^A-Za-z]+/\ /g' | sed -e '/^$/d' | sort | uniq -c | sort -n -r | head -10 | cat -n | tac
Better yet, save it in a script file, top-ten-words.sh that you can reuse:#! /bin/bash cat $* | sed -r -e 's/[^A-Za-z]+/\ /g' | sed -e '/^$/d' | sort | uniq -c | sort -n -r | head -10 | cat -n | tac
Looks complex and possibly even slightly intimidating at first, but we'll build it up piece by piece.
Slides are available at: https://docs.google.com/presentation/d/1W1plgpZ4S9qgvt-5MWyAbty26uHpu-K-Fe5qfM61u3I/
Demo examples: https://docs.google.com/presentation/d/1ZNdlLJ6txF1znvG8Ha_VfA5xcPll7kdhspH_XgA7lHU/edit?usp=sharing
About the presenter
Morris Bernstein is an experienced software engineer, most recently Founder and President of Systems Deployment, LLC (http://www.systems-deployment.com ), a training and consulting service focusing on Open Source Software . He is currently teaching Data Structures and Algorithms at UWB (http://courses.washington.edu/css343/bernstein ). For additional information, consult his linkedin profile: http://www.linkedin.com/pub/morris-bernstein/52/519/6a0