www.delorie.com/gnu/docs/gawk/gawk_11.html   search  
Buy the book!

The GNU Awk User's Guide

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1 How to Run awk Programs

There are several ways to run an awk program. If the program is short, it is easiest to include it in the command that runs awk, like this:

awk 'program' input-file1 input-file2 ...

When the program is long, it is usually more convenient to put it in a file and run it with a command like this:

awk -f program-file input-file1 input-file2 ...

This section discusses both mechanisms, along with several variations of each.

2.1.1 One-Shot Throwaway awk Programs  Running a short throwaway awk program.
2.1.2 Running awk Without Input Files  Using no input files (input from terminal instead).
2.1.3 Running Long Programs  Putting permanent awk programs in files.
2.1.4 Executable awk Programs  Making self-contained awk programs.
2.1.5 Comments in awk Programs  Adding documentation to gawk programs.
2.1.6 Shell-Quoting Issues  More discussion of shell quoting issues.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003