'awk' Script Examples

Complete Scripts

a Menu Page

Home > RefInfo menu > Computer topics menu >

(Linux) Handy Commands and Scripts Menu page >

This 'awk' Script Examples (Complete Scripts) page

! Note !
More sample 'awk' scripts may be added to
these pages --- if/when I re-visit or use these pages.

< Go to Table of Contents, below. >
(Skip the following Introduction.)

INTRODUCTION :

There are many tutorial web pages and books that contain 'snippets' of 'awk' code that give an idea of the many things you can do with 'awk' --- in particular, extracting and reformatting and calculating based on contents of text files (or text strings 'piped' to the 'awk' command).

However, many of those 'snippet' guides leave one at a loss as to how the 'awk' code can be used within a larger script that contains code leading up to the awk-usage and code that follows up on the awk-usage.

This page is meant to present script examples that amount to 'complete scripts' that make use of 'awk' --- often in conjunction with other commands such as 'grep' and 'sed' and 'sort' and 'ls' and 'find' and 'df' and 'du'.

Many of these 'complete scripts' show how the awk output is presented in a GUI text file displayer --- such as a GUI text editor.


The 'table-of-contents' below provides a menu to go to code samples from several different software systems and/or time frames.

Click on a link to see a page presenting 'complete' awk scripts.

Table of Contents:

(links to content on this page -- or on other pages of this site)

End of Table of Contents. See notes below.

Brief BACKGROUND on 'awk' shell scripting :

This page assumes the reader is familiar with shell scripting.

For a basic introduction to the Linux/Unix 'awk' command, try the Wikipedia page on 'awk'.

You may find it helpful to follow some links on Wikipedia pages.


For more details on 'awk' command options, here are a few links :

You could find more such detail by doing a WEB SEARCH on the 'strings' :

awk command help

OR

awk man page


'awk' Shell Scripting TUTORIALS / EXAMPLES :

There are many web sites that provide tutorials for 'awk' shell scripting. Unfortunately, many such sites go dead quite rapidly.

Here are a few links to some tutorials :

If these links go dead you can try what I did --- I found these helpful sites by doing a WEB SEARCH on the 'strings' :

awk shell script tutorial.

OR

awk shell script code examples.


'awk' SCRIPT-CODE WEB SEARCHES:

Since many shell scripts start off with a call to the '#!/bin/sh' or '#!/bin/ksh' or '#!/bin/bash' interpreter, one way to find 'complete' code samples involving 'awk' is to do web searches on keyword strings such as

NOTE:
Since web searchers typically replace special characters in your search strings with a blank character (and seemingly replace leading blanks by a null character),

  • a search on "#!/bin/sh"
  • a search on "bin/sh"
  • a search on "       bin sh", and
  • a search on "bin sh"
will usually return the same 'hits'. So a search on "bin sh" may suffice.

Forums:

Another handy source of help and code samples for shell scripting is forums, such as

To find more forums, you could try doing a web search on the 'strings' :


Books:

The most useful book on 'awk' shell scripting that I have ever found is the O'Reilly book, 'sed and awk Nutshell Handbook' by Dale Dougherty.

The examples in that book did not really correspond to what I wanted to do, but there is very helpful information on 'regular expressions'. If you can wade through that chapter, you will have gained a lot.

To find more books, you could try doing a web search on the 'strings' :


Some 'complete' awk scripts :

A link above (to 'awk' scripts in the 'FE Nautilus Scripts' collection) provides examples of use cases of 'awk' that are (or were) of utility to me.

The code samples on 'Freedom Environment' script-samples pages --- such as the 'feNautilusScripts' Code Samples pages --- may be, in some cases, too large for tutorials. But they have much to offer in the way of examples of working (that is, de-bugged ... to a pretty good extent) shell scripting code for shell-script developers 'of all stripes'.

Bottom of this
'awk' Script Examples (Complete Scripts) page.

To return to a previously visited web page location, click on the Back button of your web browser a sufficient number of times. OR, use the History-list option of your web browser.
OR ...

< Go to Table of Contents, above. >

< Go to Top of Page, above. >

Page was created 2018 Jun 16.
Page was changed 2018 Sep 01. (Added css and javascript to try to handle text-size for smartphones, esp. in portrait orientation.)