Download as pdf or txt
Download as pdf or txt
You are on page 1of 67

The AWK Programming Language, 2nd

Edition Aho
Visit to download the full and correct content document:
https://ebookmass.com/product/the-awk-programming-language-2nd-edition-aho/
About This eBook
ePUB is an open, industry-standard format for eBooks. However,
support of ePUB and its many features varies across reading devices
and applications. Use your device or app settings to customize the
presentation to your liking. Settings that you can customize often
include font, font size, single or double column, landscape or portrait
mode, and figures that you can click or tap to enlarge. For additional
information about the settings and features on your reading device
or app, visit the device manufacturer’s Web site.
Many titles include programming code or configuration examples. To
optimize the presentation of these elements, view the eBook in
single-column, landscape mode and adjust the font size to the
smallest setting. In addition to presenting code and configurations in
the reflowable text format, we have included images of the code
that mimic the presentation found in the print book; therefore,
where the reflowable format may compromise the presentation of
the code listing, you will see a “Click here to view code image” link.
Click the link to view the print-fidelity code image. To return to the
previous page viewed, click the Back button on your device or app.
The AWK Programming
Language
Second Edition
The AWK Programming
Language
Second Edition

Alfred V. Aho
Brian W. Kernighan
Peter J. Weinberger

Addison-Wesley
Hoboken, New Jersey
Cover image: “Great Auk” by John James Audubon from The Birds of
America, Vols. I-IV, 1827–1838, Archives & Special Collections,
University of Pittsburgh Library System

Many of the designations used by manufacturers and sellers to


distinguish their products are claimed as trademarks. Where those
designations appear in this book, and the publisher was aware of a
trademark claim, the designations have been printed with initial
capital letters or in all capitals.
The authors and publisher have taken care in the preparation of this
book, but make no expressed or implied warranty of any kind and
assume no responsibility for errors or omissions. No liability is
assumed for incidental or consequential damages in connection with
or arising out of the use of the information or programs contained
herein.
For information about buying this title in bulk quantities, or for
special sales opportunities (which may include electronic versions;
custom cover designs; and content particular to your business,
training goals, marketing focus, or branding interests), please
contact our corporate sales department at
corpsales@pearsoned.com or (800) 382-3419.

For government sales inquiries, please contact


governmentsales@pearsoned.com.
For questions about sales outside the U.S., please contact
intlcs@pearson.com.

Visit us on the Web: informit.com/aw


Library of Congress Control Number: 2023941419

Copyright © 1988, 2024 Bell Telephone Laboratories, Incorporated.


UNIX is a registered trademark of The Open Group.
This book was formatted by the authors in Times Roman, Courier
and Helvetica, using Groff, Ghostscript and other open source Unix
tools. See https://www.awk.dev.

All rights reserved. This publication is protected by copyright, and


permission must be obtained from the publisher prior to any
prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical,
photocopying, recording, or likewise. For information regarding
permissions, request forms and the appropriate contacts within the
Pearson Education Global Rights & Permissions Department, please
visit www.pearson.com/permissions.

ISBN-13: 978-0-13-826972-2
ISBN-10: 0-13-826972-6
$PrintCode
To the millions of Awk users
Contents

Preface

1. An Awk Tutorial
1.1 Getting Started
1.2 Simple Output
1.3 Formatted Output
1.4 Selection
1.5 Computing with Awk
1.6 Control-Flow Statements
1.7 Arrays
1.8 Useful One-liners
1.9 What Next?
2. Awk in Action
2.1 Personal Computation
2.2 Selection
2.3 Transformation
2.4 Summarization
2.5 Personal Databases
2.6 A Personal Library
2.7 Summary
3. Exploratory Data Analysis
3.1 The Sinking of the Titanic
3.2 Beer Ratings
3.3 Grouping Data
3.4 Unicode Data
3.5 Basic Graphs and Charts
3.6 Summary
4. Data Processing
4.1 Data Transformation and Reduction
4.2 Data Validation
4.3 Bundle and Unbundle
4.4 Multiline Records
4.5 Summary
5. Reports and Databases
5.1 Generating Reports
5.2 Packaged Queries and Reports
5.3 A Relational Database System
5.4 Summary
6. Processing Words
6.1 Random Text Generation
6.2 Interactive Text-Manipulation
6.3 Text Processing
6.4 Making an Index
6.5 Summary
7. Little Languages
7.1 An Assembler and Interpreter
7.2 A Language for Drawing Graphs
7.3 A Sort Generator
7.4 A Reverse-Polish Calculator
7.5 A Different Approach
7.6 A Recursive-Descent Parser for Arithmetic Expressions
7.7 A Recursive-Descent Parser for a Subset of Awk
7.8 Summary
8. Experiments with Algorithms
8.1 Sorting
8.2 Profiling
8.3 Topological Sorting
8.4 Make: A File Updating Program
8.5 Summary
9. Epilogue
9.1 Awk as a Language
9.2 Performance
9.3 Conclusion
Appendix A: Awk Reference Manual
A.1 Patterns
A.2 Actions
A.3 User-Defined Functions
A.4 Output
A.5 Input
A.6 Interaction with Other Programs
A.7 Summary

Index
Preface

Awk was created in 1977 as a simple programming language for


writing short programs that manipulate text and numbers with equal
ease. It was meant as a scripting language to complement and work
well with Unix tools, following the Unix philosophy of having each
program do one thing well and be composable with other programs.
The computing world today is enormously different from what it
was in 1977. Computers are thousands of times faster and have a
million times as much memory. Software is different too, with a rich
variety of programming languages and computing environments. The
Internet has given us more data to process, and it comes from all
over the world. We’re no longer limited to the 26 letters of English
either; thanks to Unicode, computers process the languages of the
world in their native character sets.
Even though Awk is nearly 50 years old, and in spite of the great
changes in computing, it’s still widely used, a core Unix tool that’s
available on any Unix, Linux, or macOS system, and usually on
Windows as well. There’s nothing to download, no libraries or
packages to import — just use it. It’s an easy language to learn and
you can do a lot after only a few minutes of study.
Scripting languages were rather new in 1977, and Awk was the
first such language to be widely used. Other scripting languages
complement or sometimes replace Awk. Perl, which dates from 1987,
was an explicit reaction to some of the limitations of Awk at the
time. Python, four years younger than Perl, is by far the most widely
used scripting language today, and for most users would be the
natural next step for larger programs, especially to take advantage
of the huge number of libraries in the Python ecosystem. On the
web, and also for some standalone uses, JavaScript is the scripting
language of choice. Other more niche languages are still highly
useful, and “the shell” itself has become a variety of different shells
with significantly enriched programming capabilities.
Programmers and other computer users spend a lot of time doing
simple, mechanical data manipulation — changing the format of
data, checking its validity, finding items that have some property,
adding up numbers, printing summaries, and the like. All of these
jobs ought to be mechanized, but it’s a real nuisance to have to
write a special-purpose program in a language like C or Python each
time such a task comes up.
Awk is a programming language that makes it possible to handle
simple computations with short programs, often only one or two
lines long. An Awk program is a sequence of patterns and actions
that specify what to look for in the input data and what to do when
it’s found. Awk searches a set of files that contain text (but not non-
text formats like Word documents, spreadsheets, PDFs and so on)
for lines that match any of the patterns; when a matching line is
found, the corresponding action is performed. A pattern can select
lines by combinations of regular expressions and comparison
operations on strings, numbers, fields, variables, and array elements.
Actions may perform arbitrary processing on selected lines; the
action language looks like C but there are no declarations, and
strings and numbers are builtin data types.
Awk scans text input files and splits each input line into fields
automatically. Because so many things are automatic — input, field
splitting, storage management, initialization — Awk programs are
usually much shorter than they would be in a more conventional
language. Thus one common use of Awk is for the kind of data
manipulation suggested above. Programs, a line or two long, are
composed at the keyboard, run once, then discarded. In effect, Awk
is a general-purpose programmable tool that can replace a host of
specialized tools or programs.
The same brevity of expression and convenience of operations
make Awk valuable for prototyping larger programs. Start with a few
lines, then refine the program until it does the desired job,
experimenting with designs by trying alternatives quickly. Since
programs are short, it’s easy to get started, and easy to start over
when experience suggests a different direction. And if necessary, it’s
straightforward to translate an Awk program into another language
once the design is right.

Organization of the Book


The goal of this book is to teach you what Awk is and how to use
it effectively. Chapter 1 is a tutorial on how to get started; after
reading even a few pages, you will have enough information to begin
writing useful programs. The examples in this chapter are short and
simple, typical of the interactive use of Awk.
The rest of the book contains a variety of examples, chosen to
show the breadth of applicability of Awk and how to make good use
of its facilities. Some of the programs are ones we use personally;
others illustrate ideas but are not intended for production use; a few
are included just because they are fun.
Chapter 2 shows Awk in action, with a number of small programs
that are derived from the way that we use Awk for our own personal
programming. The examples are probably too idiosyncratic to be
directly useful, but they illustrate techniques and suggest potential
applications.
Chapter 3 shows how Awk can be used for exploratory data
analysis: examining a dataset to figure out its properties, identify
potential (and real) errors, and generally get a grip on what it
contains before expending further effort with other tools.
The emphasis in Chapter 4 is on retrieval, validation,
transformation, and summarization of data — the tasks that Awk
was originally designed for. There is also a discussion of how to
handle data like address lists that naturally comes in multiline
chunks.
Awk is a good language for managing small, personal databases.
Chapter 5 discusses the generation of reports from databases, and
builds a simple relational database system and query language for
data stored in multiple files.
Chapter 6 describes programs for generating text, and some that
help with document preparation. One of the examples is an indexing
program based on the one we used for this book.
Chapter 7 is about “little languages,” that is, specialized
languages that focus on a narrow domain. Awk is convenient for
writing small language processors because its basic operations
support many of the lexical and symbol table tasks encountered in
translation. The chapter includes an assembler, a graphics language,
and several calculators.
Awk is a good language for expressing certain kinds of
algorithms. Because there are no declarations and because storage
management is easy, an Awk program has many of the advantages
of pseudo-code but Awk programs can be run, which is not true of
pseudo-code. Chapter 8 discusses experiments with algorithms,
including testing and performance evaluation. It shows several
sorting algorithms, and culminates in a version of the Unix make
program.
Chapter 9 explains some of the historical reasons why Awk is as
it is, and contains some performance measurements, including
comparisons with other languages. The chapter also offers
suggestions on what to do when Awk is too slow or too confining.
Appendix A, the reference manual, covers the Awk language in a
systematic order. Although there are plenty of examples in the
appendix, like most manuals it’s long and a bit dry, so you will
probably want to skim it on a first reading.
You should begin by reading Chapter 1 and trying some small
examples of your own. Then read as far into each chapter as your
interest takes you. The chapters are nearly independent of each
other, so the order doesn’t matter much. Take a quick look at the
reference manual to get an overview, concentrating on the
summaries and tables, but don’t get bogged down in the details.

The Examples
There are several themes in the examples. The primary one, of
course, is to show how to use Awk well. We have tried to include a
wide variety of useful constructions, and we have stressed particular
aspects like associative arrays and regular expressions that typify
Awk programming.
A second theme is to show Awk’s versatility. Awk programs have
been used from databases to circuit design, from numerical analysis
to graphics, from compilers to system administration, from a first
language for non-programmers to the implementation language for
software engineering courses. We hope that the diversity of
applications illustrated in the book will suggest new possibilities to
you as well.
A third theme is to show how common computing operations are
done. The book contains a relational database system, an assembler
and interpreter for a toy computer, a graph-drawing language, a
recursive-descent parser for an Awk subset, a file-update program
based on make, and many other examples. In each case, a short Awk
program conveys the essence of how something works in a form that
you can understand and play with.
We have also tried to illustrate a spectrum of ways to attack
programming problems. Rapid prototyping is one approach that Awk
supports well. A less obvious strategy is divide and conquer:
breaking a big job into small components, each concentrating on one
aspect of the problem. Another is writing programs that create other
programs. Little languages define a good user interface and may
suggest a sound implementation. Although these ideas are
presented here in the context of Awk, they are much more generally
applicable, and ought to be part of every programmer’s repertoire.
The examples have all been tested directly from the text, which is
in machine-readable form. We have tried to make the programs
error-free, but they do not defend against all possible invalid inputs,
so we can concentrate on conveying the essential ideas.

Evolution of Awk
Awk was originally an experiment in generalizing the Unix tools
grep and sed to deal with numbers as well as text. It was based on
our interests in regular expressions and programmable editors. As an
aside, the language is officially AWK (all caps) after the authors’
initials, but that seems visually intrusive, so we’ve used Awk
throughout for the name of the language, and awk for the name of
the program. (Naming a language after its creators shows a certain
paucity of imagination. In our defense, we didn’t have a better idea,
and by coincidence, at some point in the process we were in three
adjacent offices in the order Aho, Weinberger, and Kernighan.)
Although Awk was meant for writing short programs, its
combination of facilities soon attracted users who wrote significantly
larger programs. These larger programs needed features that had
not been part of the original implementation, so Awk was enhanced
in a new version made available in 1985.
Since then, several independent implementations of Awk have
been created, including Gawk (maintained and extended by Arnold
Robbins), Mawk (by Michael Brennan), Busybox Awk (by Dmitry
Zakharov), and a Go version (by Ben Hoyt). These differ in minor
ways from the original and from each other but the core of the
language is the same in all. There are also other books about Awk,
notably Effective Awk Programming, by Arnold Robbins, which
includes material on Gawk. The Gawk manual itself is online, and
covers that version very carefully.
The POSIX standard for Awk is meant to define the language
completely and precisely. It is not particularly up to date, however,
and different implementations do not follow it exactly.
Awk is available as a standard installed program on Unix, Linux,
and macOS, and can be used on Windows through WSL, the
Windows Subsystem for Linux, or a package like Cygwin. You can
also download it in binary or source form from a variety of web sites.
The source code for the authors’ version is at
https://github.com/onetrueawk/awk. The web site
https://www.awk.dev is devoted to Awk; it contains code for all the
examples from the book, answers to selected exercises, further
information, updates, and (inevitably) errata.
For the most part, Awk has not changed greatly over the years.
Perhaps the most significant new feature is better support for
Unicode: newer versions of Awk can now handle data encoded in
UTF-8, the standard Unicode encoding of characters taken from any
language. There is also support for input encoded as comma-
separated values, like those produced by Excel and other programs.
The command
$ awk --version

will tell you which version you are running. Regrettably, the default
versions in common use are sometimes elderly, so if you want the
latest and greatest, you may have to download and install your own.
Since Awk was developed under Unix, some of its features reflect
capabilities found in Unix and Linux systems, including macOS; these
features are used in some of our examples. Furthermore, we assume
the existence of standard Unix utilities, particularly sort, for which
exact equivalents may not exist elsewhere. Aside from these
limitations, however, Awk should be useful in any environment.
Awk is certainly not perfect; it has its full share of irregularities,
omissions, and just plain bad ideas. But it’s also a rich and versatile
language, useful in a remarkable number of cases, and it’s easy to
learn. We hope you’ll find it as valuable as we do.

Acknowledgments
We are grateful to friends and colleagues for valuable advice. In
particular, Arnold Robbins has helped with the implementation of
Awk for many years. For this edition of the book, he found errors,
pointed out inadequate explanations and poor style in Awk code, and
offered perceptive comments on nearly every page of several drafts
of the manuscript. Similarly, Jon Bentley read multiple drafts and
suggested many improvements, as he did with the first edition.
Several major examples are based on Jon’s original inspiration and
his working code. We deeply appreciate their efforts.
Ben Hoyt provided insightful comments on the manuscript based
on his experience implementing a version of Awk in Go. Nelson
Beebe read the manuscript with his usual exceptional thoroughness
and focus on portability issues. We also received valuable
suggestions from Dick Sites and Ozan Yigit. Our editor, Greg Doench,
was a great help in every aspect of shepherding the book through
Addison-Wesley. We also thank Julie Nahil for her assistance with
production.

Acknowledgments for the First Edition


We are deeply indebted to friends who made comments and
suggestions on drafts of this book. We are particularly grateful to Jon
Bentley, whose enthusiasm has been an inspiration for years. Jon
contributed many ideas and programs derived from his experience
using and teaching Awk; he also read several drafts with great care.
Doug McIlroy also deserves special recognition; his peerless talent as
a reader greatly improved the structure and content of the whole
book. Others who made helpful comments on the manuscript include
Susan Aho, Jaap Akkerhuis, Lorinda Cherry, Chris Fraser, Eric Grosse,
Riccardo Gusella, Bob Herbst, Mark Kernighan, John Linderman, Bob
Martin, Howard Moscovitz, Gerard Schmitt, Don Swartwout, Howard
Trickey, Peter van Eijk, Chris Van Wyk, and Mihalis Yannakakis. We
thank them all.

A
lf
r
e
d
V
.
A
h
o
B
r
i
a
n
W
.
K
e
r
n
i
g
h
a
n
P
e
t
e
r
J
.
W
e
i
n
b
e
r
g
e
r
1

An Awk Tutorial

Awk is a convenient and expressive programming language that


can be applied to a wide variety of computing and data-manipulation
tasks. This chapter is a tutorial, designed to let you start writing your
own programs as quickly as possible. The remaining chapters show
how Awk can be used to solve problems from many different areas;
the reference manual in Appendix A describes the whole language in
detail. Throughout the book, we have tried to pick examples that
you might find useful, interesting, and instructive.

1.1 Getting Started


Useful Awk programs are often short, just a line or two. Suppose
you have a file called emp.data that contains three fields of
information about your employees: name, pay rate in dollars per
hour, and number of hours worked, one employee record per line
with the fields separated by spaces or tabs, like this:
Beth 21 0
Dan 19 0
Kathy 15.50 10
Mark 25 20
Mary 22.50 22
Susie 17 18
Now you want to print the name and pay (rate times hours) for
everyone who worked more than zero hours. This is the kind of job
that Awk is meant for, so it’s easy. Type this command line (after the
command-line prompt $):
Click here to view code image
$ awk '$3 > 0 { print $1, $2 * $3 }' emp.data

You should get this output:


Kathy 155
Mark 500
Mary 495
Susie 306

This command line tells the system to run Awk, using the program
inside the quote characters, taking its data from the input file
emp.data. The part inside the quotes is the complete Awk program.
It consists of a single pattern-action statement. The pattern $3 > 0
matches every input line in which the third column, or field, is
greater than zero, and the action
{ print $1, $2 * $3 }

prints the first field and the product of the second and third fields of
each matched line.
To print the names of those employees who did not work, type
this command line:
Click here to view code image
$ awk '$3 == 0 { print $1 }' emp.data

In this example, the pattern $3 == 0 matches each line in which the


third field is equal to zero, and the action
{ print $1 }

prints its first field.


As you read this book, try running and modifying the programs
that are presented. Since most of the programs are short, you’ll
quickly get an understanding of how Awk works. On a Unix system,
the two transactions above would look like this in a terminal window:
Click here to view code image
$ awk '$3 > 0 { print $1, $2 * $3 }' emp.data
Kathy 155
Mark 500
Mary 495
Susie 306
$ awk '$3 == 0 { print $1 }' emp.data
Beth
Dan
$

The $ at the beginning of such lines is the prompt from the system;
it may be different on your computer.

The Structure of an Awk Program


Let’s step back for a moment and look at what’s going on. In the
command lines above, the parts between the quote characters are
programs written in the Awk programming language. An Awk
program is a sequence of one or more pattern-action statements:
pattern1 { action1 }
pattern2 { action2 }
...

The basic operation of Awk is to scan a sequence of input lines, from


any number of files, one after another, searching for lines that are
matched by any of the patterns in the program. The precise
meaning of “match” depends on the pattern in question; for patterns
like $3 > 0, it means “the condition is true.”
Every input line is tested against each of the patterns in turn. For
each pattern that matches, the corresponding action (which may
involve multiple steps) is performed. Then the next line is read and
the matching starts over. This continues until all the input lines have
been read.
The programs above are typical examples of patterns and
actions. Here’s an example of a single pattern-action statement; for
every line in which the third field is zero, the first field is printed.
$3 == 0 { print $1 }

It prints
Beth
Dan

Either the pattern or the action (but not both) in a pattern-action


statement may be omitted. If a pattern has no action, for example,
$3 == 0

then each line that the pattern matches (that is, each line for which
the condition is true) is printed. This program prints the two lines
from the emp.data file where the third field is zero:
Beth 21 0
Dan 19 0

If there is an action with no pattern, for example,


{ print $1 }

then the action, in this case printing the first field, is performed for
every input line.
Since patterns and actions are both optional, actions are
enclosed in braces to distinguish them from patterns. Completely
blank lines are ignored.

Running an Awk Program


There are two ways to run an Awk program. You can type a
command line of the form
awk ’program’ input files

to run the program on each of the specified input files. For example,
you could type
Click here to view code image
awk '$3 == 0 { print $1 }' file1 file2

to print the first field of every line of file1 and then file2 in which
the third field is zero.
You can omit the input files from the command line and just type
awk ’program’

In this case Awk will apply the program to whatever you type next
on your terminal until you type an end-of-file signal (Control-D on
Unix systems). Here is a sample of a session on Unix; the italic text
is what the user typed.
$ awk '$3 == 0 { print $1 }'
Beth 21 0
Beth
Dan 19 0
Dan
Kathy 15.50 10
Kathy 15.50 0
Kathy
Mary 22.50 22
...

This behavior makes it easy to experiment with Awk: type your


program, then type data at it and see what happens. We encourage
you to try the examples and variations on them.
Notice that the program is enclosed in single quotes on the
command line. This protects characters like $ in the program from
being interpreted by the shell and also allows the program to be
longer than one line.
This arrangement is convenient when the program is only one or
two lines long. If the program is longer, however, it may be easier to
put it into a separate file, say progfile, and type the command line
Click here to view code image
awk -f progfile optional list of input files
The -f option instructs Awk to fetch the program from the named
file. Any filename can be used in place of progfile; if the filename is
-, the standard input is used.

Errors
If you make an error in an Awk program, Awk will give you a
diagnostic message. For example, if you type a bracket when you
meant to type a brace, like this:
Click here to view code image
$ awk '$3 == 0 [ print $1 }' emp.data

you will get a message like this:


Click here to view code image
awk: syntax error at source line 1
context is
$3 == 0 >>> [ <<<
extra }
missing ]
awk: bailing out at source line 1

“Syntax error” means that you have made a grammatical error that
was detected at the place marked by >>> <<<. “Bailing out” means
that no recovery was attempted. Sometimes you get a little more
help about what the error was, such as a report of mismatched
braces or parentheses.
Because of the syntax error, Awk did not try to execute this
program. Some errors, however, may not be detected until your
program is running. For example, if you attempt to divide a number
by zero, Awk will stop its processing and report the input line and
the line number in the program at which the division was attempted.
1.2 Simple Output
The rest of this chapter contains a collection of short, typical Awk
programs based on manipulation of the emp.data file above. We’ll
explain briefly what’s going on, but these examples are meant
mainly to suggest useful operations that are easy to do with Awk —
printing fields, selecting input, and transforming data. We are not
showing everything that Awk can do by any means, nor are we
going into many details about the specific things presented here. But
by the end of this chapter, you will be able to accomplish quite a bit,
and you’ll find it much easier to read the later chapters.
We will usually show just the program, not the whole command
line. In every case, the program can be run either by enclosing it in
quotes as the first argument of the awk command, as above, or by
putting it in a file and invoking Awk on that file with the -f option.
There are only two types of data in Awk: numbers and strings of
characters. The emp.data file is typical of this kind of information —
a sequence of text lines containing a mixture of words and numbers
separated by spaces and/or tabs.
Awk reads its input one line at a time and splits each line into
fields, where, by default, a field is a sequence of characters that
doesn’t contain any spaces or tabs. The first field in the current
input line is called $1, the second $2, and so forth. The entire line is
called $0. The number of fields can vary from line to line.
Often, all we need to do is print some or all of the fields of each
line, perhaps performing some calculations. The programs in this
section are all of that form.

Printing Every Line


If an action has no pattern, the action is performed for all input
lines. The statement print by itself prints the current input line, so
the program
{ print }
prints all of its input on the standard output. Since $0 is the whole
line,
{ print $0 }

does the same thing.

Printing Specific Fields


More than one item can be printed on the same output line with
a single print statement. The program to print the first and third
fields of each input line is
{ print $1, $3 }

With emp.data as input, it produces


Beth 0
Dan 0
Kathy 10
Mark 20
Mary 22
Susie 18

Expressions separated by a comma in a print statement are, by


default, separated by a single space when they are printed. Each line
produced by print ends with a newline character. Both of these
defaults can be changed; we’ll show how in later examples and in
Section A.4.2 of the reference manual.

NF, the Number of Fields


It might appear that you must always refer to fields as $1, $2,
and so on, but any expression can be used after $ to denote a field
number; the expression is evaluated and its numeric value is used as
the field number. Awk counts the number of fields in the current
input line and stores the count in a built-in variable called NF. Thus,
the program
{ print NF, $1, $NF }

prints the number of fields and the first and last fields of each input
line.

Computing and Printing


You can also do computations on the field values and include the
results in what is printed. The program
{ print $1, $2 * $3 }

is a typical example. It prints the name and total pay (that is, rate
times hours) for each employee:
Beth 0
Dan 0
Kathy 155
Mark 500
Mary 495
Susie 306

In a moment we’ll show how to make this output look better.

Printing Line Numbers


Awk provides another built-in variable, called NR, that counts the
number of lines (records) read so far. We can use NR and $0 to prefix
each line of emp.data with its line number, like this:
{ print NR, $0 }

The output looks like this:


1 Beth 21 0
2 Dan 19 0
3 Kathy 15.50 10
4 Mark 25 20
5 Mary 22.50 22
6 Susie 17 18
Putting Text in the Output
You can also print words in the midst of fields and computed
values, by including quoted strings of characters in the list:
Click here to view code image
{ print "total pay for", $1, "is", $2 * $3 }

prints
total pay for Beth is 0
total pay for Dan is 0
total pay for Kathy is 155
total pay for Mark is 500
total pay for Mary is 495
total pay for Susie is 306

In the print statement, the text inside the double quotes is printed
along with the fields and computed values.

1.3 Formatted Output


The print statement is meant for quick and easy output. To
format the output exactly the way you want it, you may have to use
the printf statement. As we will see in many subsequent examples,
printf can produce almost any kind of output, but in this section
we’ll only show a few of its capabilities. Section A.4.3 gives the
details.

Lining Up Fields
The printf statement has the form
Click here to view code image
printf( format, value1, value2, ... , valuen)
where format is a string that contains text to be printed verbatim,
interspersed with specifications of how each of the values is to be
printed. A specification is a % followed by a few characters that
control the format of a value. The first specification tells how value1
is to be printed, the second how value2 is to be printed, and so on.
Thus, there must be as many % specifications in format as values to
be printed. (The printf statement is almost the same as the printf
function in the standard C library.)
Here’s a program that uses printf to print the total pay for every
employee:
Click here to view code image
{ printf("total pay for %s is $%.2f\n", $1, $2 * $3) }

The specification string in the printf statement contains two %


specifications. The first, %s, says to print the first value, $1, as a
string of characters; the second, %.2f, says to print the second
value, $2 * $3, as a number with 2 digits after the decimal point.
Everything else in the specification string, including the dollar sign, is
printed verbatim; the \n at the end of the string stands for a
newline, which causes subsequent output to begin on the next line.
With emp.data as input, this program yields:
Click here to view code image
total pay for Beth is $0.00
total pay for Dan is $0.00
total pay for Kathy is $155.00
total pay for Mark is $500.00
total pay for Mary is $495.00
total pay for Susie is $306.00

With printf, no spaces or newlines are produced automatically; you


must create them yourself. If you forget the \n, the output will all be
on a single line.
Here’s another program that prints each employee’s name and
pay:
Click here to view code image
{ printf("%-8s $%6.2f\n", $1, $2 * $3) }

The first specification, %-8s, prints a name as a string of characters


left-justified in a field 8 characters wide; the minus sign signals that
the name is to be left-justified in its field. The second specification,
%6.2f, prints the pay as a number with two digits after the decimal
point, in a field 6 characters wide:
Beth $ 0.00
Dan $ 0.00
Kathy $155.00
Mark $500.00
Mary $495.00
Susie $306.00

We’ll show lots more examples of printf as we go along; the full


story can be found in Section A.4.3.

Sorting the Output


Suppose you want to print all the data for each employee, along
with his or her pay, sorted in order of increasing pay. The easiest
way is to use Awk to prefix the total pay to each employee record,
and run that output through a sorting program.
On Unix, the command line
Click here to view code image
awk '{ printf("%6.2f %s\n", $2 * $3, $0) }' emp.data |

pipes the output of Awk into the sort command, and produces:
0.00 Beth 21 0
0.00 Dan 19 0
155.00 Kathy 15.50 10
306.00 Susie 17 18
495.00 Mary 22.50 22
500.00 Mark 25 20
It’s quite possible to write an efficient sort program in Awk itself;
there’s an example Quicksort in Chapter 8. But most of the time, it’s
more productive to use existing tools like sort.

1.4 Selection
Awk patterns are good for selecting interesting lines from the
input for further processing. Since a pattern without an action prints
all lines matching the pattern, many Awk programs consist of
nothing more than a single pattern. This section gives some
examples of useful patterns.

Selection by Comparison
This program uses a comparison pattern to select the records of
employees who earn $20 or more per hour, that is, lines in which the
second field is greater than or equal to 20:
$2 >= 20

It selects these lines from emp.data:


Beth 21 0
Mark 25 20
Mary 22.50 22

Selection by Computation
The program
Click here to view code image
$2 * $3 > 200 { printf("$%.2f for %s\n", $2 * $3, $1) }

prints the pay of those employees whose total pay exceeds $200:
$500.00 for Mark
$495.00 for Mary
$306.00 for Susie

Selection by Text Content


Besides numeric tests, you can select input lines that contain
specific words or phrases. This program prints all lines in which the
first field is Susie:
$1 == "Susie"

The operator == tests for equality. You can also look for text
containing any of a set of letters, words, and phrases by using
patterns called regular expressions. This program prints all lines that
contain Susie anywhere:
/Susie/

The output is this line:


Susie 17 18

Regular expressions can be used to specify much more elaborate


text patterns; Section A.1.4 contains a full discussion.

Combinations of Patterns
Patterns can be combined with parentheses and the logical
operators &&, || , and !, which stand for AND, OR, and NOT. The
program
$2 >= 20 || $3 >= 20

prints those lines where $2 is at least 20 or $3 is at least 20:


Beth 21 0
Mark 25 20
Mary 22.50 22

Lines that satisfy both conditions are printed only once. Contrast this
with the following program, which consists of two patterns:
$2 >= 20
$3 >= 20

This program prints an input line twice if it satisfies both conditions:


Beth 21 0
Mark 25 20
Mark 25 20
Mary 22.50 22
Mary 22.50 22

Note that the program


!($2 < 20 && $3 < 20)

prints lines where it is not true that $2 is less than 14 and $3 is less
than 20; this condition is equivalent to the first one above, though
less readable.

Data Validation
Real data always contains errors. Awk is an excellent tool for
checking that data is in the right format and has reasonable values,
a task called data validation.
Data validation is essentially negative: instead of printing lines
with desirable properties, one prints lines that are suspicious. The
following program uses comparison patterns to apply five plausibility
tests to each line of emp.data:
Click here to view code image
NF != 3 { print $0, "number of fields is not equal to
$2 < 15 { print $0, "rate is too low" }
$2 > 25 { print $0, "rate exceeds $25 per hour" }
$3 < 0 { print $0, "negative hours worked" }
$3 > 60 { print $0, "too many hours worked" }

If there are no errors, there’s no output.


BEGIN and END
The special pattern BEGIN matches before the first line of the first
input file is read, and END matches after the last line of the last file
has been processed. This program uses BEGIN to print a heading;
the words are separated by the right number of spaces.
Click here to view code image
BEGIN { print "NAME RATE HOURS"; print "" }
{ print }

The output is:


NAME RATE HOURS

Beth 21 0
Dan 19 0
Kathy 15.50 10
Mark 25 20
Mary 22.50 22
Susie 17 18

You can put several statements on a single line if you separate them
by semicolons. Notice that print "" prints a blank line, quite
different from just plain print, which prints the current input line.

1.5 Computing with Awk


An action is a sequence of statements separated by newlines or
semicolons. You have already seen examples in which the action was
a single print or printf statement. This section provides examples
of statements for performing simple numeric and string
computations. In these statements you can use not only the built-in
variables like NF, but you can create your own variables for
performing calculations, storing data, and the like. In Awk, user-
created variables are not declared; they come into existence when
you use them.
Counting
This program uses a variable emp to count the number of
employees who have worked more than 15 hours:
Click here to view code image
$3 > 15 { emp = emp + 1 }
END { print emp, "employees worked more than 15 hou

For every line in which the third field exceeds 15, the previous value
of emp is incremented by 1. With emp.data as input, this program
yields:
Click here to view code image
3 employees worked more than 15 hours

Awk variables used as numbers begin life with the value 0, so we


didn’t need to initialize the variable emp.
Statements like
emp = emp + 1

occur so frequently that C and languages inspired by it provide an


increment operator ++ as a shorthand equivalent:
emp++

There is a corresponding decrement operator -- that will appear


shortly.
We can rewrite the counting example with ++, like this:
Click here to view code image
$3 > 15 { emp++ }
END { print emp, "employees worked more than 15 hou
Computing Sums and Averages
To count the number of employees, we could instead use the
built-in variable NR, which holds the number of lines read so far; its
value at the end of all input is the total number of lines read.
END { print NR, "employees" }

The output is:


6 employees

Here is a program that uses NR to compute the average pay:


Click here to view code image
{ pay = pay + $2 * $3 }
END { print NR, "employees"
print "total pay is", pay
print "average pay is", pay/NR
}

The first action accumulates the total pay for all employees. The END
action prints
6 employees
total pay is 1456
average pay is 242.667

Clearly, printf could be used to produce neater output, for example


to produce exactly two digits after the decimal point. There’s also a
potential error: in the unlikely case that NR is zero, the program will
attempt to divide by zero and thus will generate an error message.
The operator += is an abbreviation for incrementing a variable: it
increments the variable on its left by the value of the expression on
its right, so the first line of the program above could be more
compactly written as
{ pay += $2 * $3 }
Handling Text
Awk variables can hold strings of characters as well as numbers.
This program finds the employee who is paid the most per hour:
Click here to view code image
$2 > maxrate { maxrate = $2; maxemp = $1 }
END { print "highest hourly rate:", maxrate, "for", max

It prints
Click here to view code image
highest hourly rate: 25 for Mark

In this program the variable maxrate holds a numeric value, while


the variable maxemp holds a string. If there are several employees
who all make the same maximum pay, this program reports only the
first.

String Concatenation
New strings may be created by pasting together old ones; this
operation is called concatenation. The string concatenation operation
is represented in an Awk program by writing string values one after
the other; there is no explicit concatenation operator. (In hindsight,
this design might not be ideal, because it can sometimes lead to
hard-to-spot errors.)
As an illustration of string concatenation, the program
{ names = names $1 " " }
END { print names }

collects all the employee names into a single string, by appending


each name and a space to the previous value in the variable names.
The value of names is printed by the END action:
Click here to view code image
Beth Dan Kathy Mark Mary Susie

At every input line, the first statement in the program concatenates


three strings: the previous value of names, the first field, and a
space; it then assigns the resulting string to names. Thus, after all
input lines have been read, names contains a single string consisting
of the names of all the employees, each followed by a space (so
there is an invisible space at the end of the string). Variables used to
store strings begin life holding the null string (that is, the string
containing no characters), so in this program names did not need to
be explicitly initialized.

Printing the Last Input Line


Built-in variables like NR retain their value in an END action, and so
do fields like $0. The program
END { print $0 }

is one way to print the last input line.


Susie 17 18

Built-in Functions
We have already seen that Awk provides built-in variables that
maintain frequently used quantities like the number of fields and the
input line number. Similarly, there are built-in functions for
computing other useful values.
Besides arithmetic functions for square roots, logarithms, random
numbers, and the like, there are also functions that manipulate text.
One of these is length, which counts the number of characters in a
string. For example, this program computes the length of each
person’s name:
{ print $1, length($1) }

The result:
Beth 4
Dan 3
Kathy 5
Mark 4
Mary 4
Susie 5

Counting Lines, Words, and Characters


This program uses length, NF, and NR to count the number of
lines, words, and characters in the input, like the Unix program wc.
For convenience, we’ll treat each field as a word, though that is a bit
of a simplification.
Click here to view code image
{ nc += length($0) + 1
nw += NF
}
END { print NR, "lines,", nw, "words,", nc, "characters

The file emp.data has


Click here to view code image
6 lines, 18 words, 71 characters

We have added 1 to nc to count the newline character at the end of


each input line, because $0 doesn’t include it.

1.6 Control-Flow Statements


Awk provides an if-else statement for making decisions and
several statements for writing loops, all modeled on those found in
the C programming language. They can only be used in actions.
If-Else Statement
The following program computes the total and average pay of
employees making more than $30 an hour. It uses an if to defend
against any potential division by zero in computing the average pay.
Click here to view code image
$2 > 30 { n++; pay += $2 * $3 }

END { if (n > 0)
print n, "high-pay employees, total pay is
" average pay is", pay/n
else
print "No employees are paid more than $30
}

The output for emp.data is:


Click here to view code image
No employees are paid more than $30/hour

In the if-else statement, the condition following the if is


evaluated. If it is true, the first print statement is performed.
Otherwise, the second print statement is performed. Note that we
can continue a long statement over several lines by breaking it after
a comma.
Note also that if an if statement controls only a single
statement, no braces are necessary, though they are if more than
one statement is controlled. This version
Click here to view code image
$2 > 30 { n++; pay += $2 * $3 }

END { if (n > 0) {
print n, "employees, total pay is", pay,
" average pay is", pay/n
} else {
print "No employees are paid more than $30
Another random document with
no related content on Scribd:
A B 1, nous pouvons rattacher tout un côté des œuvres classées
en A 1 de la XXVIIe.
Est-il besoin que je fasse remarquer le petit nombre, mais la
terrible beauté des œuvres ci-dessus ? Est-il nécessaire d’indiquer
les variétés infinies du remords, selon : 1o la faute commise (pour
ce, énumérer tous les délits et crimes selon le code, — plus ceux-là
qui ne tombent pas sous le coup d’une loi ; la faute, d’ailleurs, sera,
à volonté, réelle, imaginaire, non voulue mais accomplie, voulue
mais non accomplie, — ce qui réserve le « dénouement heureux »,
— voulue et accomplie, préméditée ou non, avec ou sans complicité,
impulsions étrangères, raffinement, que sais-je !) ; 2o la nature plus
ou moins impressionnable et nerveuse du coupable ; 3o le milieu, les
circonstances, les mœurs qui préparent l’apparition du remords
(forme plastique, solide et religieuse chez les Grecs ; fantasmagories
énervantes de notre moyen-âge ; craintes pieuses pour l’autre vie,
dans les siècles récents ; déséquilibre logique des instincts sociaux
et par suite de la pensée, selon les indications de Zola, etc.).
Au Remords tient l’Idée fixe ; par sa tentation permanente, elle
rappelle d’autre part la Folie ou la Passion criminelle, et n’est, très
souvent, que le remords d’un désir, remords d’autant plus vivace
que le désir renaît sans cesse et l’alimente, s’y mêle et, grandissant
comme une sorte de cancer moral, pompe la vitalité entière d’une
âme, peu à peu, jusqu’au suicide, lequel n’est, presque toujours, que
le plus désespéré des duels. René, Werther, le maniaque du Cœur
révélateur et de Bérénice (celle d’Edgar Poe, j’entends) et surtout le
Rosmersholm d’Ibsen, en sont des portraits significatifs.
XXXV e SITUATION
Retrouver

(Le Retrouvé — Le Retrouvant)

C’est le Héros et la Nymphe de Kalidaça, la seconde partie de sa


Çakountala, et la Suite de l’histoire de Rama, par Bhavabouti, la
seconde partie aussi du Conte d’hiver et du Périclès de
Shakespeare ; c’était Thyeste à Sicyone, de Sophocle, et Alcméon à
Corinthe, d’Euripide ; c’est, encore, le dénouement du Père
Chasselas (M. Athis, 1886) et des Foulards rouges (M. Dornay,
1882) ; et c’est la Gardienne d’Henri de Régnier ; c’est la légendaire
intrigue des « voleuses d’enfants », et « histoires d’enfants trouvés »
et « séquestrations arbitraires », depuis le Masque de fer (sur lequel
Victor Hugo commença un drame, Les Jumeaux), depuis Richard
Cœur-de-Lion, jusqu’aux histoires récentes de prétendus fous
internés comme tels, et c’est de là qu’est partie tant de fois la double
explosion de la scène capitale et capiteuse : « Ma fille ! — Ma
mère ! »
A et C de la XIe ont aussi pour but de « Retrouver ».
D’autres fois il appartiendra à l’enfant, bel aventurier, de
découvrir son père, son parent, et de s’en faire reconnaître : ainsi
dans les « enfances Roland ».
J’attribue à la solution invariablement heureuse et épithalamique
de nos drames édifiés sur cette Situation, et aux coïncidences dont
elle se saupoudrait trop généreusement, le dégoût qui finit par en
prendre le public. Car n’est-elle pas, au contraire, plus que la XIXe,
restée naturelle ? or, quelle n’a pas été la fécondité de cette XIXe,
dont notre XXXVe conserve cependant tout le charme et la variété
séductrice ?
XXXVI e SITUATION
Perdre les siens

(Le Proche frappé — Le Proche spectateur — Le Bourreau)

Voici le Deuil. En longues files d’enterrements, vous les voyez


passer, les héros de cette donnée, venus sur terre pour l’y figurer
puisqu’ils sont hommes ; ils vont de la maison noire à la formidable
église et de là au cimetière, puis retournent au foyer pleurer… en
attendant de repartir pour un autre d’entre eux. C’est la majesté de
ce sublime tombeau de Philippe Pot, que nous avons au Louvre et
qui égale la statuaire grecque.
A — Impuissant, voir tuer ses enfants : — Niobé et Troïlus
d’Eschyle, Polyxène et Les Captives de Sophocle, une partie de son
Laocoon, Les Troyennes d’Euripide et de Sénèque. Autant de
réductions, sous une image saisissante, de notre vie : n’assistons-
nous pas, liés à un invisible poteau, à l’assassinat, à la torture des
nôtres par le bourreau qui nous domine ?
B — Deviner la mort d’un proche : — L’Intruse, les Sept
Princesses de Maeterlinck, le seul maître moderne de la XXXVIe et,
voyez, si puissant.
C — Apprendre la mort d’un allié : — partie du Rhésus
attribué à Euripide, Penthésilée, la Psychostase et la Mort d’Achille,
par Eschyle ; les Éthiopiens de Sophocle. Ici s’ajoute le difficile rôle
du messager de malheur, celui qui se courbe sous les imprécations
de Cléopâtre, dans Shakespeare.
Mais, incarnez dans une figure de tortionnaire le meurtre, abstrait
dans la plupart de ces exemples. A l’impuissance attaché, regardez
alors se débattre le malheureux rendu spectateur de l’agonie, et
implorer, et appeler, follement, dans le ciel ! La Victime, pendant ce
temps, réduite à rien, prie humblement, comme s’il y pouvait, celui
qui la voit et qui se désespère ! La haute et ricanante silhouette du
Bourreau assiste, et il affine et exaspère les douleurs, avec
dilettantisme…
Le Dante n’a rien su imaginer qui fût plus âpre en les cercles de
l’Enfer !
Pour obtenir les nuances des 36 Situations, j’ai eu recours à des
procédés à peu près constants : par exemple, j’énumérais les liens,
sociaux ou de parenté, possibles entre les personnages ; ou bien, je
déterminais, pour ceux-ci, leur degré de conscience, de volonté libre
et de connaissance du but réel où ils vont. Et l’on a vu que, lorsqu’on
voulait altérer la clairvoyance normale dans l’un des deux
adversaires, il fallait principalement le remplacer par deux rôles, le
premier devenant l’aveugle instrument du second, élevé du même
coup jusqu’à une subtilité machiavélique, tant sa part d’action se
faisait, au contraire, purement intellectuelle ; de sorte que, diminuée
à l’excès chez l’un, la vision nette des choses s’augmentait en
proportion chez l’autre. — Un nouvel élément à modifier toutes les
situations est l’énergie des actes qui doivent en résulter : soit le
meurtre ; il se réduira à une blessure, un coup, une tentative, un
outrage, une intimidation, une menace, une parole trop vive, une
intention non suivie d’effet, une tentation, une pensée, un souhait, ou
à un droit lésé, à la destruction d’un objet chéri, à un refus de
secours, un manque de pitié, un abandon, un mensonge. Si l’on
veut, ce meurtre (de même, pour ses diminutifs) n’aura pas visé
l’objet de la haine en personne, mais un être qui soit aimé de celui-
ci. Ce meurtre, enfin, pourra être multiple et aggravé des
circonstances que la législation a prévues. — Troisième méthode
pour varier les données : à celui-ci ou à celui-là des deux
adversaires dont la lutte constitue notre drame, on substituera une
pluralité qu’un seul désir animera, mais dont chaque membre
rétractera ce désir sous un de ses divers jours. — Il n’est pas non
plus (je l’ai déjà laissé voir) de Situation qui ne soit susceptible d’être
combinée avec n’importe laquelle de ses voisines, que dis-je ? avec
deux, trois, quatre, cinq, six d’entre elles, et davantage ! Or, ces
combinaisons se feront de bien des sortes : 1er cas, les Situations se
développent successivement et logiquement l’une de l’autre ; 2e cas,
elles se disposent en un dilemme, au milieu duquel trébuche le
héros éperdu ; 3e cas, chacune appartient à un rôle ou groupe
spécial ; puis 4e, 5e, 6e cas, etc., elles sont représentées selon 2 ou
selon les 3 cas déjà énoncés à la fois : c’est-à-dire qu’une Situation
va, je suppose, englober d’abord les personnages ; ensemble, ils
s’en évadent ; — mais la plupart tombent, de là, dans quelque
position non moins critique, et tel même n’a plus qu’à opter entre
deux conduites également pénibles ; après des courses affolées
entre cette Charybde et cette Scylla, l’élan par lequel il leur échappe
le précipite, et, avec lui, le reste des acteurs, dans une suprême
Situation, sourdie des précédentes et qui, jaillie, les emporte en une
gerbe finale !… Bien entendu, ceci n’est qu’une combinaison entre
mille ; car je ne veux ni ne puis exposer à présent le système
complet qui continue cette étude des 36 Situations et au moyen
duquel je les fais se multiplier sans fin : c’est l’affaire d’un travail à
publier séparément, sur les lois de l’Invention littéraire.
A son tour, la Composition, — qui consiste à ordonner ces
Situations une fois précisées et, du même coup, les épisodes et les
figures mises en scène, — se déduira, d’une manière enfin un peu
neuve et sérieuse, de la même théorie des « Trente-Six ».
Considérant en effet que toute Situation dramatique naît d’un conflit
entre deux directions principales d’efforts (d’où, simultanément,
notre terreur devant la victorieuse et notre pitié pour la vaincue),
nous aurons, dès le lever du rideau, à choisir entre deux débuts : il
nous faudra décider lequel des deux adversaires préexiste, ce qui
nous amène infailliblement à faire du second la cause (innocente ou
responsable) du drame, puisque c’est son arrivée qui sera le signal
de la lutte ; le premier, qui s’offre surtout à notre observation, est le
Protagoniste qu’on trouvait déjà dans la tragédie toute lyrique,
descriptive et analytique de Thespis ; le second, l’obstacle survenu
ou rencontré, c’est l’Antagoniste, ce principe de l’action que nous
devons au génie objectif et homérique d’Eschyle [8] . Nous
imposerons donc à l’œuvre entière deux couleurs bien opposées,
selon que, dès le commencement, nous aurons attribué à celui-ci ou
à celui-là des partis la puissance la plus grande, les chances de
victoires les plus sérieuses.
[8] C’est du moins comment je m’explique le fameux
passage de La Poétique attribuant à Eschyle
l’introduction d’un deuxième personnage et à Sophocle
celle d’un troisième, alors que dans Eschyle et même
dans ses prédécesseurs un bien plus grand nombre
d’acteurs se montrent rassemblés. Évidemment, Aristote
compte pour un seul personnage les rôles, si nombreux
soient-ils, qui suivent une direction parallèle d’efforts ; et
pour lui, l’introduction du 2e personnage signifie la
représentation, également intéressante, de 2 individus ou
groupes adverses : ainsi, dans La Débâcle, où Zola a
peint une armée, un pays, notre philosophe n’aurait
discerné qu’un seul personnage et aurait vainement
cherché du second une ébauche, même aussi pâle que
celle apparaissant au travers du fantôme dans l’action,
encore archaïque, des Perses.

Aristote déjà nous apprit à distinguer entre la tragédie simple (où


la supériorité demeure du même côté jusqu’au bout, où, par
conséquent, il n’y a point de péripétie, de surprise) et la tragédie
implexe (tragédie à surprise, à péripétie), où cette supériorité passe
d’un camp dans l’autre. Les dramaturges ont, depuis, raffiné sur la
dernière : dans celles de leurs pièces dont l’action est peu
compliquée, ils doublent la péripétie, ce qui fait revenir
ingénieusement, à l’instant précédant le départ du spectateur, les
deux puissances en l’état exact où elles se trouvaient quand il entra
dans la salle ; dans leurs drames à action compliquée, ils triplent,
quadruplent, quintuplent la péripétie aussi longtemps que le leur
permettent leur imaginative et la patience d’un public débonnaire.
Ces vicissitudes de la lutte, voilà donc le premier moyen de varier un
sujet. Cela ne va pas, du reste, très loin, puisque nous ne pouvons,
avec la naïveté la plus extrême, recevoir, du drame ou de la vie, que
1.332 surprises. — 1.332 ? — Évidemment ; qu’est-ce qu’une
surprise un peu vive, sinon le passage d’un état de calme à une
Situation dramatique ou bien d’une Situation à une autre, ou à un
nouvel état de calme ? Faites la multiplication ; résultat : 1.332.
Demandons-nous à présent d’où proviennent ces vicissitudes et
ces inattendus déplacements de l’équilibre ? De quelque influence
apparemment, — influence partie d’un objet matériel, d’une
circonstance ou d’un troisième personnage. Sur ce Tiers Acteur, —
dont l’inauguration fut jadis le triomphe sophocléen — devait reposer
ce qu’on nomme l’intrigue ; à lui seul, il est l’imprévu, l’idéal convoité
des deux parts et le « milieu ambiant » ; fantastiquement, il s’est
morcelé et multiplié, par deux, par trois, par dix, par plus encore,
jusqu’à encombrer la scène, mais c’est toujours lui, le si
reconnaissable ; tels de ses fragments se sont faits « Impulseurs »,
tels « Objets disputés », tels « Instrumentaux », et ils se sont rangés,
qui du côté du Protagoniste, qui devers l’Antagoniste, ou bien,
courant çà et là, ils provoquaient cette « chute incessamment
évitée » qui s’appelle, pour les événements comme pour l’homme, la
marche ; et de la sorte, clairement ils évoquaient leur origine, — ce
Rôle-Lien (Jocaste des Sept contre Thèbes, Sabine d’Horace) sous
lequel le Tiers Acteur germa dans la tragédie eschylienne, mais sans
prendre encore une part positive à l’action. On concevra que
l’arrivée de ces figures de 2e plan, — renforcées par celles du fond,
Annonciateurs dont l’importance va du Tirésias au Messager de
l’Œdipe-roi, — du prophète au facteur, — Chœurs, Confidents,
Foules, Burlesques, Utilités, voire Figurants, modifie avec une
puissance singulière l’effet d’ensemble ; surtout si l’on réfléchit à
ceci : chacun d’eux, pris à part, a ses motifs pour agir, et le voilà
bientôt, à l’égard de ceux qui l’entourent, dans quelque situation
dramatique subordonnée sans doute à la dominante, mais réelle
néanmoins ; les sursauts de l’action générale l’affectent, lui, d’une
façon spéciale, et les conséquences, pour lui, de chaque péripétie,
de chaque effort, de chaque action et du dénouement, contribuent à
l’impression définitive sur le spectateur. Le Tiers Acteur est-il plus
particulièrement un Objet disputé, il faut tenir compte de son premier
et de son dernier possesseur, des diverses relations qu’il a
successivement avec eux, et de ses préférences. Se présente-t-il
comme Impulseur, il faut alors considérer (outre ses degrés de
conscience ou d’inconscience, de franchise ou de dissimulation, et
de volonté propre) la persévérance qu’il apporte à son œuvre, la
découverte qu’il peut faire, s’il fut inconscient, de son inconscience,
et s’il fut dissimulé celle qu’on fera de sa dissimulation (on, c’est-à-
dire soit un seul ou plusieurs des personnages, soit le spectateur).
Remarques qui s’appliquent aussi au rôle « Instrumental » ; et non
seulement ces remarques, mais celles qui concernaient « l’Objet »,
doivent être faites pour le Rôle-Lien.
J’ai déjà dit que ce dernier et la triple hypostase du Tiers Acteur
peuvent se reproduire à de nombreux exemplaires dans une même
pièce. En revanche, deux ou trois ou les quatre peuvent se fondre
en une seule figure : Lien-Instrumental, Objet-Impulseur, Instrument-
Lien-Objet, etc., combinaisons qui se présentent (telles, plus haut,
les combinaisons de situations) en ordres variables : tantôt le héros
qui réunit en lui ces divers rôles les joue simultanément, soit tous
vis-à-vis d’un individu ou groupe, soit un ou plusieurs de ces rôles
vis-à-vis d’un individu ou groupe et un autre rôle ou mélange de ces
rôles vis-à-vis de tel autre individu ou groupe ; tantôt ces rôles divers
seront successivement joués vis-à-vis du même individu ou groupe,
ou de plusieurs ; tantôt enfin le héros joue ces rôles simultanément
ici et successivement là.
Mais je ne puis ni ne veux, non plus, détailler en ces pages la
seconde partie de l’Art de Combiner, celle que nous nommons en
France, — d’un terme d’ailleurs si faible, l’a remarqué Gœthe, — la
« composition » : le jour où je l’exposerai, j’aurai soin de l’éclairer par
des exemples progressifs, tant historiques (je veux, par là, signifier :
pris à toutes les grandes sources existantes, théâtre, épopée,
roman, histoire, causes célèbres) que techniques, c’est-à-dire
produits, agencés exprès sous les yeux et en la collaboration du
lecteur. Ce que j’ai seulement voulu lui faire pressentir, c’est :
d’abord, qu’un unique travail crée, à la fois, les épisodes, ou actions
des personnages, et les personnages, car ceux-ci ne sont, à la
scène, que ce qu’ils font ; puis, comment invention et composition,
ces deux modes de l’Art de Combiner (et non d’imaginer ! mot
vide…) sortiront, très naturellement, par nos travaux à venir, de la
Théorie des 36 Situations.
Dès maintenant, j’offre (sans ironie aucune, très sérieusement)
aux auteurs dramatiques ainsi qu’à MM. les directeurs de théâtre Dix
Mille scénarios — totalement différents de ceux qui ont été mis à la
rampe, plus ou moins de fois, dans ces cinquante dernières années ;
ces scénarios seront, cela va sans dire, d’un caractère absolument
actuel. Je m’engage à livrer le mille en huit jours. La simple grosse
n’exigera que vingt-quatre heures. On peut faire prix pour une seule
douzaine. Écrire ou s’adresser 19, passage de l’Élysée des Beaux-
Arts, de 5 heures à 9 heures du matin. — Les données sont
détaillées acte par acte, et, au besoin, scène par scène.
… Mais je m’entends accuser, avec violence, de vouloir « détruire
l’imagination ». Phantasmophone ! monstricide ! destructeur de
prodiges !… Ces titres herculéens ne me couvrent d’aucune rougeur.
Une singulière histoire, vraiment, que celle de l’Imagination…
Nul, certes, aux temps classiques, ne s’en eût osé prévaloir. Loin de
là ! à peine avancée, toute nouveauté allait, vite et timidement,
s’appuyer à quelque autorité antique. De 1830 date l’avènement au
trône littéraire de cette « Faculté » charlatanesque et, paraît-il, à
jamais interdite à l’analyse ; les conséquences du nouveau régime
ne tardèrent pas à se montrer, et elles se laissent voir dans leur
délabrement final chez les derniers successeurs du romantisme
romanesque : crime mystérieux, puis erreur judiciaire commise par
l’éternel juge d’instruction au profil en « lame de couteau », suivie de
l’inévitable amour entre les enfants du meurtrier et de la victime ;
dans une chambrette, une délicate et pure ouvrière ; passant par là,
un jeune ingénieur idéalisant la casquette ; le voyou criminel mais
tendre ; deux « fins limiers » de police ; l’épisode de l’enfant volé,
avec voix du sang, und so weit ; et, pour clore, le suicide imposé au
coquin, sans oublier, par derrière, afin de soulager les cœurs
sensibles, au moins un double mariage d’amour, — voilà, bon an
mal an, ce que rapporte l’Imagination. Au reste, de tout le
romantisme dramatique (qui correspond si bien à l’école des
Carrache en peinture), Hugo seul avait créé ; grâce à quoi ? à un
procédé technique, patiemment appliqué dans les moindres
détails : l’antithèse de l’être et du paraître.
Énergiquement, la légende de l’Imagination fut, un instant, battue
en brèche par le positivisme ; il a protesté que cette soi-disant
faculté créatrice n’est que le kaléidoscope de nos souvenirs agités
au hasard. Mais pas assez il n’a insisté sur le résultat inévitablement
banal et monotone de ces agitations, tels de nos souvenirs, les
moins intéressants et les moins personnels précisément, se trouvant
répétés, dans notre cerveau, à mille exemplaires, et revenant sans
merci dans toutes les combinaisons dépourvues de méthode. Il
fallait le crier comme un tocsin : ces souvenirs, qui sont les lectures
innombrables des produits d’imitation de notre passé néo-classique
et romantique, enveloppent et noient jusqu’à l’observation sur nature
que signala, comme élément de rénovation, l’initiative des
Naturalistes ; ceux-ci même ont vu trop souvent la réalité à travers
des souvenirs livresques ; ils comptèrent trop sur l’innéité du
tempérament artistique, si vigoureux soit-il, en espérant qu’il
s’interposerait, seul et purifié de conventions, par un simple effort de
« volonté », entre la nature et l’œuvre à engendrer ; c’est ainsi que la
Bête humaine nous a répété l’erreur judiciaire, sous la forme
spéciale où elle est aussi fréquente dans les lettres qu’elle l’est peu
dans le fait ; c’est ainsi que le point de départ de l’Œuvre ne fut que
le contre-pied de la « thèse » des Goncourt et de Daudet ; c’est ainsi
que des réminiscences de Mme Bovary font dévier, vers elle, des
études de cas analogues, mais qui devraient en demeurer très
distincts ; — et qu’est apparue, dès la seconde génération
naturaliste, une nouvelle école de copie et de traditions.
Tandis qu’au moyen de l’Art de Combiner, — renfermant le total
« des possibilités », leur encyclopédie et leur table de multiplication,
et formant comme « le traité des proportions de l’Événement », — la
vérité pourra être parcourue avec un regard vainqueur de tous les
fantômes du poncif (enfermés à leurs places respectives dans cette
nomenclature), — avec un regard libre, un regard hellène ! [9]
[9] Car les Grecs, dès une époque reculée, avaient
pris l’habitude de tout systématiser — à l’instar des aïeux
de l’Inde, — conduite que nous tînmes aussi jusqu’au
XIVe siècle. Vers elle nous nous étions instinctivement
retournés, attirés par Aristote, à l’âge classique, avec nos
théoriciens si injustement décriés depuis, si utiles et si
respectés de nos grands dramaturges. En ces jours de la
gloire française, la moindre réflexion poétique n’effarait
pas des paresses superstitieuses.

L’observation, la création, pour chaque écrivain, auront dès lors


un point de départ extérieur au monde du papier, un point de départ
qui leur soit personnel, original enfin, ce qui ne veut pas dire le
moins du monde plus invraisemblable, au contraire, puisque tant de
situations, d’allures aujourd’hui si invraisemblables, se sont
défigurées de la sorte justement aux mains de gens qui, ne sachant
comment faire neuf, compliquaient en s’empêtrant dans leurs
propres écheveaux.
Et surtout, l’invention d’une fable insolite (langage idéaliste), ou la
découverte d’un coin vierge (langage naturaliste) se trouvera
facilitée jusqu’à ne plus avoir aucune valeur. On n’ignore pas quelle
importance eut, dans le perfectionnement de l’art grec, le fait d’être
circonscrit à un petit nombre de légendes (Œdipe, Agamemnon,
Phèdre, etc.), que chaque poète devait à son tour reprendre sans
pouvoir éviter d’être comparé, pas à pas, à chacun de ses
devanciers, de sorte que le moins critique des spectateurs
appréciait, à coup sûr, la part de personnalité et de goût mise à
l’œuvre nouvelle ;… tout au plus cette tradition eut-elle pour
inconvénient de rendre l’originalité plus difficile. Par l’étude des 36
Situations et de ses conséquences, le même avantage s’obtiendra,
sans l’inconvénient signalé. — Et seule, désormais, prendra valeur
la Proportion.
Toutefois, qu’on me comprenne ! Par Proportion, je n’entends
nullement un recueil de formules compassées et rappelant aux
lettrés des souvenirs qui leur sont chers, — mais la mise en bataille,
sous les pieds de l’écrivain, de l’armée infinie des combinaisons
possibles, rangées selon leurs ressemblances, et comprenant le ban
des tentatives faites comme l’arrière-ban des tentatives inosées.
Alors, pour manifester la vérité ou la sensation que lui seul perçut
jusque-là, et encore difficilement, parmi le touffu des phénomènes et
dans des cas peu accentués, l’auteur n’aura qu’à se pencher ; et,
sans se livrer au hasard infructueux d’un vagabondage, par une
rapide revue de ce champ poétique, il élira celle des données et
ceux des détails les plus propres à ses desseins. Or, cette méthode,
ou, si l’on veut, cette liberté et cette puissance, il l’aura, non
seulement dans le choix, la limitation et la fécondation de son sujet,
mais dans son observation, dans sa méditation.
Et il ne courra pas plus de danger de fausser, par des idées
préconçues, la vue du réel que n’en court, par exemple, le peintre
dans l’application de ces lois, générales également et contrôlées de
même par une expérimentation quotidienne, — de ces lois sublimes
de la perspective !
La proportion, réalisable enfin dans le calme donné par la
possession complète de l’art de combiner, et reprenant le rang
suprême usurpé jadis par le simple « bon goût » et naguère par la
charlatanesque mais non moins pauvre « imagination », fera
reconnaître cette… chose un peu oubliée de l’art moderne, le
« beau » : celui-ci n’est pas, à mon sens, un prétendu choix distingué
dans la nature (le Discobole, Aristophane, etc., renversent les
palissades d’un tel parc à moutons) ; je préférerais dire que c’est la
peinture habile, directe, sans tâtonnements, sans que rien demeure
de superflu, d’oiseux ni de secondaire, du « coin de nature » vu.
Mais c’est plus encore.
Car les deux définitions, l’éclectique et la naturaliste, ne
concernent qu’une restreinte partie des arts et qu’un seul de leurs
côtés : ce petit nombre à qui l’imitation est ouverte (peinture,
littérature à personnages, et, à la rigueur, sculpture), et de celles-ci
le côté, encore, purement imitatif. Que signifient en effet nos deux
définitions (qui, l’une comme l’autre, reposent sur la reproduction de
la réalité, l’une pour en exalter l’importance et l’autre pour la lui
chicaner), si on les confronte avec : — la Musique, — la Poésie
didactique d’un Hésiode, — les incantations Védiques et
Mallarmiennes, — la véritable Statuaire, simplifiée et significatrice, à
grands coups de ciseau, comme celle du XIIIe siècle et celle de
Phidias, — l’Ornemental et le Décoratif, — la « beauté » d’une
Démonstration géométrique (l’Uranie ancienne), — l’Éloquence de
raisonnement, — l’Architecture enfin, cet art qui renaît à cette heure
dans le silence et l’oubli, cet art qui vient périodiquement réunir, et,
tel qu’une arche, sauver les autres, cet art qui va une fois de plus
nous enlever aux niaiseries prématurément séniles des dilettantes et
des sectaires [10] .
[10] Il est vrai que M. Joséphin Péladan diagnostique
de l’Architecture qu’elle est décédée en 1789 ! et, à sa
suite, l’ignare troupeau, qui de son verbe tire subsistance,
fait chorus. Le premier gavroche, levant son index,
démontrerait le contraire, en preuves visibles : à
commencer par notre Arc de Triomphe, qui vaut certes à
lui seul toute la construction du siècle dernier et ennoblit
l’ouest de Paris, — pour aboutir au récent et cyclopéen
travail du fer, soulevant dans les édifices, auxquels il est
encore intérieur, des salles comme la Bibliothèque, les
Halles, le Palais des Machines, et prêt déjà à éclore aux
surfaces en élégances et en énergies inconnues — sans
oublier, en passant, Mazas, MM. de l’ésotérisme !

A cette hauteur se tient en effet un principe plus large que le


naturalisme avec sa méthode expérimentale et que les idéalismes
qui lui livrent bataille : la Logique.
D’elle se réclame ce mien travail. On peut voir en lui d’ailleurs
une suite, si l’on veut, de l’observation naturaliste. N’est-il pas la
même œuvre, transportée du « coin de nature » au « tempérament »
jusqu’ici laissé en friche, l’expérience « préparée » sur le terrain des
déductions, selon qu’il est d’usage en astronomie ? N’est-ce pas, en
quelque sorte, le nettoyage de la vitre, la taille préalable de la lentille
par où le public verra ?…
Au moyen de cette logique, ou convenance, Viollet-le-Duc a fait
apprécier les merveilles de notre grand siècle, du Siècle XIII, —
substituant, pour ne citer que cela, à la candide admiration de 1830,
devant tel saint de pierre « si pittoresquement » juché sur la pointe
d’une ogive, cette explication profonde de bon constructeur : à savoir
qu’une pierre du poids et des dimensions exactes de ce saint était,
là, indispensable pour empêcher l’ogive d’éclater sous la double
pression latérale, — d’où la satisfaction instinctive de nos yeux.
C’est un grand malheur que la compréhension de cet âge
magnifique où un saint Louis présidait la multiple vie communale, et
dont le seul égal au monde fut le siècle où Périclès dirigeait, de la
métropole athénienne, un mouvement identique, que cette
compréhension, qui nous serait si utile, ait été horriblement
compromise dans le carnaval romantique : le livre de Notre-Dame de
Paris, admirable du reste à sa date, mais où le public croit tenir un
portrait de ce « moyen-âge » (l’appellation la plus absurde, entre
parenthèses !), le représente, par un choix bizarre, mort depuis
longtemps, — après la guerre de cent années qui nous anémia au
point que nous tombâmes, sans défense et passifs, sous la
domination de l’art national florentin, dit renaissant, puis des
diverses influences anciennes et étrangères pour quatre siècles ! Et,
jusqu’à cette minute même où j’écris, ç’a été pitié que de lire quoi
que ce fût de littéraire au sujet du passé le plus incomparable : hier,
un Renan parlait de l’art ogival comme un effort demeuré
impuissant ! (Souvenirs d’enfance et de jeunesse) ou père d’œuvres
peu durables ! (Prière sur l’Acropole) ; demain, dans En route, qui va
paraître, un critique sagace aux questions contemporaines,
Huysmans, fera la plus stupéfiante salade avec les voûtes romanes,
la peinture des Primitifs, le plain-chant grégorien, salade dont la
recette infaillible est « la foi », bien entendu, et qui s’appelle le
« moyen-âge », naturellement, ce qui n’embrasse que dix siècles de
l’humanité, plus du tiers de son histoire authentique, trois époques
fort ennemies l’une de l’autre, des peuples très opposés, — quelque
chose d’équivalent à un mariage entre Alcibiade et Sainte-
Geneviève…
Le « moyen-âge », ou, pour parler plus proprement, les siècles
XII, XIII et XIV, ne furent aucunement fantaisistes et capricieux ; c’eût
été l’affaire d’une génération, comme sous Louis-Philippe. Il ne fut
pas davantage mystique, au sens du jour, qui prend pour le
monument le brouillard qui l’enveloppe à nos yeux. Son architecture
fut édifiée pierre par pierre, dessin à dessin, par les raisons les plus
pratiques. Dans sa sculpture, il n’y a jamais eu de naïf — que nous,
quand nous la croyions telle ; elle est réaliste bien plus que la nôtre,
et, si pour persister dans l’opinion contraire on se raccroche aux
formes étranges des gargouilles, nous dirons que, nées d’un
symbolisme frère de ceux d’Égypte et de Grèce, elles figurent les
analogies également ingénieuses et profondes, obscurément
remémorées plus tard par un Cornélius Agrippa, et d’où sont sorties
nos classifications naturelles, — qui peut-être un jour y retourneront.
Sur ce temps s’élevait le Thomisme, dernièrement remis en honneur
pour combattre le positivisme, et qui réalisa une si heureuse
harmonie entre l’aristotélisme et la foi, entre la science et
l’indispensable théologie ; car alors la raison était adorée au-dessus
de tout dans le syllogisme, et la « mysticité » se déduisait plus
patiemment que nos métaphysiques ; alors naissaient les sciences
naturelles, et, dans l’oreille des poètes, se choisissaient toutes les
lois sur lesquelles vit notre poésie, ces rythmes que nous en
sommes encore à voir au travers de Ronsard, cette Rime que nous
avons donnée à l’Europe en même temps que ta Voûte à Nervures,
ô petite ville de Saint-Denis, suzeraine oriflamme, barque-pilote de la
France ! Tout cela naissait et grandissait au sourire grave et doux de
la même sagesse qui s’appela, sur les bords de la mer Ionienne,
Athénè.
Vers un nouvel aspect de cette même logique appareille déjà
notre époque, maintenant que, bue l’antiquité avec les forces de
laquelle nous régnâmes une seconde fois sur l’Europe au XVIIe, et
bue avec l’influence germanique la dernière des grandes influences
étrangères, nous nous retournons sur la réalité, sur l’avenir ; ainsi,
quand chaque cité grecque eut absorbé les voisins cultes locaux
(ses « influences étrangères ») et les cultes d’Orient (l’antiquité
d’alors), se forma la plus belle des mythologies. C’est, du moins, à
un art purement logique, purement technicien, aux créations
d’ailleurs infiniment variées, que me semblent converger toutes nos
tendances littéraires. J’y vois partis Flaubert et Zola, ces âpres
précurseurs, non point par tel de leurs écrits, mais par l’ensemble, et
Ibsen et Strindberg, et tous ces écrivains volontairement oublieux de
leurs bibliothèques comme les Hellènes le furent des lettres
barbares ; là, va Maeterlinck, ayant réduit l’action au développement
d’une idée unique ; et Verlaine, délivrant des règles conventionnelles
et superstitieusement révérées le rythme vrai, qui se donne à lui-
même ses règles, Verlaine, faisant chanter à pleine voix les grandes
orgues du Vers, renouvelé avec la justesse d’oreille de ces
ménestrels créateurs des précédentes cadences ; là-bas tend aussi
Mallarmé, prince de l’ellipse, lorsqu’il aère la syntaxe, en expulsant
la nuée de nos petits mots parasites et nos loqueteuses formules,
imitées des décadences anciennes et exhumées, dirait-on, des
« traités de phraséologie » pour la préparation de la licence ; lorsqu’il
forge et incurve l’hyperbole d’un parler nouveau en proportion avec
le poids des idées qu’il doit porter ; en cette direction nous appelle
Moréas, à cette source de notre littérature, mais sans se dégager,
malheureusement, de l’italianisme de notre soi-disant renaissance et
sans s’élancer assez haut dans le passé ; et devers ce dernier
flottent jusqu’à nos plus récents mystiques, bien qu’incertains, peut-
être, parmi leurs brumes violettes, entre ces deux grèves, de dix
siècles distantes, la fin du monde romain et l’arrêt de notre culture
médiéviste ; oui, tous ceux-là, et d’autres non moins glorieux, me
paraissent aller au même but : après la destruction des formes
conventionnelles latines, accomplie en 1830 mais au profit des
passagères prépondérances saxonnes, l’abolition définitive de toute
autorité absolue, même de celle de la nature et de nos sciences, ses
actuelles interprètes ; puis l’édification, au-dessus de ces débris, de
la simple logique, d’un art uniquement technicien et capable, par ce
fait, de révéler un système harmonique inconnu, d’un art — artiste
en un mot.
… En littératures, en la dramatique qui particulièrement nous
occupe, l’examen des Proportions que j’ai annoncé plus haut et que
je rêve comme un Vignoles non seulement de tel théâtre, mais de
tous comparés entre eux, cet examen nous fera voir les diverses
« façons générales » de présenter une Situation quelconque :
chacune de ces « façons générales », contenant ainsi une espèce de
canon applicable à toute situation indifféremment, constituera pour
nous un « ordre » analogue aux ordres d’architecture, et qui, de
même, prendra place avec d’autres ordres dans un « système »
théâtral. Mais les systèmes, à leur tour, se rapprocheront sous des
rubriques plus générales dont les comparaisons nous fourniront
aussi maint sujet à réflexions. Dans ce qu’on pourrait nommer la
Féerie se rencontrent étrangement, par exemple, des systèmes
aussi éloignés d’origine que les drames de l’Inde, certaines des
« comédies » de Shakespeare (le Songe d’une Nuit d’été, la
Tempête), le genre fiabesque de Gozzi, Faust ; le Mystère réunit les
œuvres de la Perse, Job, Thespis et les pré-eschyliens, Prométhée,
le théâtre d’Ézéchiel le Tragique, de Saint-Grégoire de Nazianze, de
Hroswitha, de notre XIIIe siècle, les autos ; ici, la Tragédie grecque et
ses imitations de psychologues ; là, le Drame anglais, allemand, et
français de 1830 ; plus près, la Pièce, qui du fond de la Chine, par
Lope et Calderon, Diderot et Gœthe, enserre notre scène
d’aujourd’hui… On se rappelle combien, quand nous cataloguions la
production dramatique dans ses 36 données, la recherche assidue,
pour tout cas exceptionnel en l’une, des cas symétriques à établir
dans les 35 autres faisait surgir, sous nos pas, de sujets imprévus.
De même, quand nous aurons analysé ces ordres, systèmes et
groupes de systèmes, quand nous aurons mesuré avec minutie
leurs ressemblances et leurs différences, et que nous les aurons
classés en distributions multiples, où, tour à tour, selon les
questions, nous les aurons rapprochés et éloignés, — nous
remarquerons nécessairement que de nombreuses combinaisons
ont été oubliées ;… parmi elles, se choisira l’art nouveau.
Puissé-je avoir posé la première, la plus obscure pierre
fondamentale de sa gigantesque citadelle ; là, vendangeant sous
ses pieds les âmes des poètes, la Muse s’élèvera devant l’auditoire
de nouveau rassemblé des vieux aèdes, devant ces peuples jadis
serrés autour d’Hérodote et de Pindare, et qu’on dispersa depuis
dans les poudreuses bibliothèques ou dans l’ignorance primitive ;
elle clamera… cette nouvelle langue, — mieux faite encore pour
eux, — la dramatique, trop haute pour que la comprenne, isolée, une
individualité, fût-elle la plus grande, un langage énorme en vérité,
non de mots, mais de frissons, tels que celui qu’on parle aux
armées, — et qui ne s’adresse qu’à toi, abstrait mais seul éternel,
seul dispensateur de gloire, âme des foules, délire du monde, ô
Bacchos ! Ce ne sera pas, sans doute, dans une de nos salonnières
et minuscules réductions en carton-pâte d’un demi-cirque romain,
coupées d’un rideau pourpre, mais sur une manière de montagne,
remplie d’air et de lumière, élevée grâce à l’expérience constructive
du moyen-âge et à notre conquête du fer, offerte à la nation par ceux
qui auront gardé jusque-là la vanité d’être riches, et où
tourbillonneraient ensemble nos vingt-deux entreprises de
représentations, quelque chose de mieux que cette salle de Chicago
où se réunissent pourtant dix mille personnes, de mieux que le
théâtre de Dionysos, lequel en contenait trente mille, de mieux
même que celui d’Éphèse où s’asseyaient, joyeux, cent cinquante
mille spectateurs, un immense orifice par où la terre embrasse le
ciel, et qui s’épanouisse comme un cratère !

FIN

You might also like