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