[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 4

regcmp Command


Compiles patterns into C language char declarations.


regcmp [ - ] File [ File ... ]


The regcmp command compiles the patterns in File and places output in a File.i file, or a File.c file when the - option is specified. The resulting compiled patterns are initialized char declarations. Each entry in File must be a C variable name followed by one or more blanks, followed by a pattern enclosed in " " (double quotation marks).

The output of the regcmp command is C source code. A resulting File.i file can be included in C programs, and a resulting File.c file can be a file parameter to the cc command.

A C language program that uses the output of the regcmp command should use the regex subroutine to apply it to a string.

In most cases, the regcmp command makes unnecessary the use of the regcmp subroutine in a C language program, saving execution time and program size.


- Places the output in a File.c file. The default is to put the output in File.i.


  1. To compile the patterns in stdin1 and the patterns in stdin2, enter:

    regcmp stdin1 stdin2

    This creates the stdin1.i and stdin2.i files.

  2. To creates stdin1.c and stdin2.c files, enter:

    regcmp - stdin1 stdin2

    Note: Assuming that the same stdin1 and stdin2 files are used in both examples, the resulting stdin1.i and stdin1.c files are identical, and the resulting stdin2.i and stdin2.c files are identical.


/usr/ccs/bin/regcmp Contains the regcmp command.

Related Information

The regcmp or regex subroutine.

The Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]