]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | Copyright (C) 2016 and later: Unicode, Inc. and others. |
2 | License & terms of use: http://www.unicode.org/copyright.html#License | |
3 | ||
73c04bcf | 4 | Copyright (c) 2002-2005, International Business Machines Corporation and others. All Rights Reserved. |
b75a7d8f A |
5 | ugrep: a sample program demonstrating the use of ICU regular expression API. |
6 | ||
7 | usage: ugrep [options] pattern [file ...] | |
8 | ||
9 | --help Output a brief help message | |
10 | -n, --line-number Prefix each line of output with the line number within its input file. | |
11 | -V, --version Output the program version number | |
12 | ||
13 | ||
14 | The program searches for the specified regular expression in each of the | |
15 | specified files, and outputs each matching line. | |
16 | ||
17 | Input files are in the system default (locale dependent) encoding, unless they | |
18 | begin with a BOM, in which case they are assumed to be in the UTF encoding | |
19 | specified by the BOM. Program output is always in the system's default | |
20 | 8 bit code page. | |
21 | ||
22 | ||
23 | Files: | |
24 | ./ugrep.c source code for the sample | |
73c04bcf A |
25 | ./ugrep.sln Windows MSVC workspace. Double-click this to get started. |
26 | ./ugrep.vcproj Windows MSVC project file. | |
b75a7d8f A |
27 | ./Makefile Makefile for Unixes. Needs gmake. |
28 | ||
29 | ||
30 | To Build ugrep on Windows | |
31 | 1. Install and build ICU | |
73c04bcf | 32 | 2. In MSVC, open the workspace file icu\samples\ugrep\ugrep.sln |
b75a7d8f A |
33 | 3. Choose a Debug or Release build. |
34 | 4. Build. | |
35 | ||
36 | To Run on Windows | |
37 | 1. Start a command shell window | |
38 | 2. Add ICU's bin directory to the path, e.g. | |
39 | set PATH=c:\icu\bin;%PATH% | |
40 | (Use the path to where ever ICU is on your system.) | |
41 | 3. cd into the ugrep directory, e.g. | |
42 | cd c:\icu\source\samples\ugrep\debug | |
43 | 4. Run it | |
44 | ugrep ... | |
45 | ||
46 | ||
47 | To Build on Unixes | |
48 | 1. Build ICU. Specify an ICU install directory when running configure, | |
49 | using the --prefix option. The steps to build ICU will look something | |
50 | like this: | |
51 | cd <icu directory>/source | |
52 | runConfigureICU <platform-name> --prefix <icu install directory> [other options] | |
53 | gmake all | |
54 | ||
55 | 2. Install ICU, | |
56 | gmake install | |
57 | ||
58 | 3. Build the sample | |
59 | Put the install directory containing icu-config on the $PATH. | |
60 | This will generally be <icu install directory>/bin | |
61 | cd <icu directory>/source/samples/ugrep | |
62 | gmake | |
63 | ||
64 | To Run on Unixes | |
65 | cd <icu directory>/source/samples/ugrep | |
66 | ||
67 | export LD_LIBRARY_PATH=<icu install directory>/lib:.:$LD_LIBRARY_PATH | |
68 | ugrep ... | |
69 | ||
70 | ||
71 | Note: The name of the LD_LIBRARY_PATH variable is different on some systems. | |
72 | If in doubt, run the sample using "gmake check", and note the name of | |
73 | the variable that is used there. LD_LIBRARY_PATH is the correct name | |
74 | for Linux and Solaris. |