General Purpose Tools

Diomidis Spinellis
Department of Management Science and Technology
Athens University of Economics and Business
Athens, Greece

The Unix Toolchest

Available under Unix, GNU/Linux, *BSD.

For Windows:

Working with Unix Tools

Data Fetching and Generation





Example: Analyze Java Files

Examine all Java files located in the directory src, and print the ten files with the highest number of occurrences of a method call to substring.
find src -name ’*.java’ -print |
xargs fgrep -c .substring |
sort -t-rn -k2 |
head -10

Example: Determine Commit Times

find . -type f |
grep -v CVS |
xargs cvs -d /home/ncvs log -SN 2>/dev/null |
awk '/^date/{
    hour = substr($3, 0, 2)
    lines[$5 " " hour] += $9
 END {
    for (i in lines) print i, lines[i]
  }' |
sed 's/;//g' |
sort >dev-times-lines.dat
join dev-times-lines.dat devlong >dev-times-lines-long.dat

Example Result:Plotted Commit Times

Round the clock development

Program Development

(More on the above later.)

Outwit Tools

Outwit Examples

Create an list of fax recipients ordered by the number of faxes they have received.
readlog Application |
awk -F: "/Outbound: Information: Fax Sent/{print $12}" |
sort |
uniq -c |
sort -rn
Extracts the email address from all records from the table users which is part of the database userDB and sends them the file message by email.
fmt message |
mail $(odbc DSN=userDB "select email from users")

An Editor Checklist

Two candidates: Emacs, vim.

Further Reading

Exercises and Discussion Topics

  1. Acquaint yourself with the command-line of the computer you're using. If it doesn't have ready access to the Unix tools, install them.
  2. Evaluate the editor you're using, and adopt a new one if needed.