Sample Data Files (The GNU Awk User’s Guide)

From Get docs
Gawk/docs/latest/Sample-Data-Files

Next: Very Simple, Previous: Running gawk, Up: Getting Started   [Contents][Index]



1.2 Data files for the Examples

Many of the examples in this Web page take their input from two sample data files. The first, mail-list, represents a list of peoples’ names together with their email addresses and information about those people. The second data file, called inventory-shipped, contains information about monthly shipments. In both files, each line is considered to be one record.

In mail-list, each record contains the name of a person, his/her phone number, his/her email address, and a code for his/her relationship with the author of the list. The columns are aligned using spaces. An ‘A’ in the last column means that the person is an acquaintance. An ‘F’ in the last column means that the person is a friend. An ‘R’ means that the person is a relative:

Amelia       555-5553     [email protected]    F
Anthony      555-3412     [email protected]   A
Becky        555-7685     [email protected]      A
Bill         555-1675     [email protected]       A
Broderick    555-0542     [email protected] R
Camilla      555-2912     [email protected]     R
Fabius       555-1234     [email protected]    F
Julie        555-6699     [email protected]   F
Martin       555-6480     [email protected]    A
Samuel       555-3430     [email protected]        A
Jean-Paul    555-2127     [email protected]     R

The data file inventory-shipped represents information about shipments during the year. Each record contains the month, the number of green crates shipped, the number of red boxes shipped, the number of orange bags shipped, and the number of blue packages shipped, respectively. There are 16 entries, covering the 12 months of last year and the first four months of the current year. An empty line separates the data for the two years:

Jan  13  25  15 115
Feb  15  32  24 226
Mar  15  24  34 228
Apr  31  52  63 420
May  16  34  29 208
Jun  31  42  75 492
Jul  24  34  67 436
Aug  15  34  47 316
Sep  13  55  37 277
Oct  29  54  68 525
Nov  20  87  82 577
Dec  17  35  61 401

Jan  21  36  64 620
Feb  26  58  80 652
Mar  24  75  70 495
Apr  21  70  74 514

The sample files are included in the gawk distribution, in the directory awklib/eg/data.



Next: Very Simple, Previous: Running gawk, Up: Getting Started   [Contents][Index]