1Copyright (C) 2016 and later: Unicode, Inc. and others. 2License & terms of use: http://www.unicode.org/copyright.html#License 3 4Copyright (c) 2002-2005, International Business Machines Corporation and others. All Rights Reserved. 5ugrep: a sample program demonstrating the use of ICU regular expression API. 6 7usage: 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 14The program searches for the specified regular expression in each of the 15specified files, and outputs each matching line. 16 17Input files are in the system default (locale dependent) encoding, unless they 18begin with a BOM, in which case they are assumed to be in the UTF encoding 19specified by the BOM. Program output is always in the system's default 208 bit code page. 21 22 23Files: 24 ./ugrep.c source code for the sample 25 ./ugrep.sln Windows MSVC workspace. Double-click this to get started. 26 ./ugrep.vcproj Windows MSVC project file. 27 ./Makefile Makefile for Unixes. Needs gmake. 28 29 30To Build ugrep on Windows 31 1. Install and build ICU 32 2. In MSVC, open the workspace file icu\samples\ugrep\ugrep.sln 33 3. Choose a Debug or Release build. 34 4. Build. 35 36To 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 47To 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. 75