Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

gmatch(3gen) [php man page]

gmatch(3GEN)					     String Pattern-Matching Library Functions					      gmatch(3GEN)

NAME
gmatch - shell global pattern matching SYNOPSIS
cc [ flag ... ] file ... -lgen [ library ... ] #include <libgen.h> int gmatch(const char *str, const char *pattern); DESCRIPTION
gmatch() checks whether the null-terminated string str matches the null-terminated pattern string pattern. See the sh(1), section File Name Generation, for a discussion of pattern matching. A backslash () is used as an escape character in pattern strings. RETURN VALUES
gmatch() returns non-zero if the pattern matches the string, zero if the pattern does not. EXAMPLES
Example 1: Examples of gmatch() function. In the following example, gmatch() returns non-zero (true) for all strings with "a" or "-" as their last character. char *s; gmatch (s, "*[a-]" ) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
sh(1), attributes(5) NOTES
When compiling multithreaded applications, the _REENTRANT flag must be defined on the compile line. This flag should only be used in mul- tithreaded applications. SunOS 5.10 29 Dec 1996 gmatch(3GEN)

Check Out this Related Man Page

gmatch(3GEN)					     String Pattern-Matching Library Functions					      gmatch(3GEN)

NAME
gmatch - shell global pattern matching SYNOPSIS
cc [ flag ... ] file ... -lgen [ library ... ] #include <libgen.h> int gmatch(const char *str, const char *pattern); DESCRIPTION
gmatch() checks whether the null-terminated string str matches the null-terminated pattern string pattern. See the sh(1), section File Name Generation, for a discussion of pattern matching. A backslash () is used as an escape character in pattern strings. RETURN VALUES
gmatch() returns non-zero if the pattern matches the string, zero if the pattern does not. EXAMPLES
Example 1 Examples of gmatch() function. In the following example, gmatch() returns non-zero (true) for all strings with "a" or "-" as their last character. char *s; gmatch (s, "*[a-]" ) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
sh(1), attributes(5) NOTES
When compiling multithreaded applications, the _REENTRANT flag must be defined on the compile line. This flag should only be used in mul- tithreaded applications. SunOS 5.11 29 Dec 1996 gmatch(3GEN)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

to separate a specific pattern

Hi friends, I have a file with following pattern. OBJECT TYPE="locale", NAME=locale_nl_NL, UNIQUE_FIELD=win32_lcid FIELDS clarify_lang = 0; END_FIELDS END_OBJECT NAME=locale_nl_NL OBJECT TYPE="locale", NAME=locale_nl_BE UNIQUE_FIELD=win32_lcid FIELDS iso_cntry =... (11 Replies)
Discussion started by: shriashishpatil
11 Replies

2. Shell Programming and Scripting

Pattern Matching

How to print the words with matching pattern. GREP lists the lines matching given pattern. But I want those words that matches the pattern (10 Replies)
Discussion started by: op4_u
10 Replies

3. UNIX for Dummies Questions & Answers

Matching string

Hello, i have a program where i have to get a character from the user and check it against the word i have and then replace the character in a blank at the same position it is in the word. (7 Replies)
Discussion started by: nehaquick
7 Replies

4. Shell Programming and Scripting

Pattern Matching

Hi Folks, I have the following requirement: I have a file that is containing numerous queries. The tables name mentioned in the queries are in the following format : SchemaName.Tablename. e.g COPDB.TableName. I need to take out all the COPDB.TableName pattern and write it to a different... (6 Replies)
Discussion started by: Siv_Pat
6 Replies

5. Shell Programming and Scripting

Perl Pattern Matching:Unix Vs. Window (Is it OS dependent??)

Hi All, Below I am discussing the problem I am facing while using pattern matching in Unix & Window. Plz hv a look into it. ================ my $s="UPDATE A SET s="klkkk' ;" ; if ( $s =~ m/^*UPDATE+/i ) { print $s; } else { print "no match";} =================== Both should... (6 Replies)
Discussion started by: Niroj
6 Replies

6. Shell Programming and Scripting

Help Needed Perl

Hi, I need your help on this script wherein I am matching up the input phone numbers for a partical pattern (xxx-xxxx). However in this I want to have null output where first value of input is null. ( For Example: $record = " ,111-5555") . Ideally I would expect to recieve input in this format... (6 Replies)
Discussion started by: john_prince
6 Replies

7. UNIX for Dummies Questions & Answers

Search and Count Occurrences of Pattern in a File

I need to search and count the occurrences of a pattern in a file. The catch here is it's a pattern and not a word ( not necessarily delimited by spaces). For eg. if ABCD is the pattern I need to search and count, it can come in all flavors like (ABCD, ABCD), XYZ.ABCD=100, XYZ.ABCD>=500,... (6 Replies)
Discussion started by: tektips
6 Replies

8. Shell Programming and Scripting

Extracting the strings matching a pattern from a word

Hi All , I need to extract the strings that are matching with the pattern : CUST.<AnyStringOfAnyLength>.<AnyStringOfAnyLength> from a file and then write all these string into another file. e.g. If a file SOURCE contains following lines : IF(CUST.ABCD.EFGH==1) THEN CUST.ABCD.EFGH =... (7 Replies)
Discussion started by: swapnil.nawale
7 Replies

9. UNIX for Dummies Questions & Answers

Find next line based on pattern, if it is similar pattern skip it

Hi, I am able to get next line if it is matching a particular pattern. But i need a way to skip if next line also matches same pattern.. For example: No Records No Records Records found got it Records found Now i want to find 'Records found' after 'No Records' pattern matches.. ... (5 Replies)
Discussion started by: nagpa531
5 Replies

10. Shell Programming and Scripting

Pattern Matching in Perl script

I have a big perl script need to fix a small pattern matching inside .. I have patterns like create unique index create index The pattern matching should look for both the pattern in the same statement, The existing matching looks for only "create unique index" The exising code for this i... (6 Replies)
Discussion started by: greenworld123
6 Replies

11. Shell Programming and Scripting

Replace a string pattern

Hi, I have a CSV with following type of data and would like to replace the timestamp information with 'null' string. Can you please suggest me on same? 8,1,'1','1',11,'2013-08-12 18:34:17.0','null',1,'2013-08-12 18:34:17.0','null','PROMOTIONAL','12','1','11','11',11,'0' Thanks for your... (10 Replies)
Discussion started by: bhupinder08
10 Replies

12. Shell Programming and Scripting

Splitting textfile based on pattern and name new file after pattern

Hi there, I am pretty new to those things, so I couldn't figure out how to solve this, and if it is actually that easy. just found that awk could help:(. so i have a textfile with strings and numbers (originally copy pasted from word, therefore some empty cells) in the following structure: SC... (9 Replies)
Discussion started by: luja
9 Replies

13. Shell Programming and Scripting

Pattern Matching and replacement

Hello Everybody, I need a help in the below pattern matching and replacement issue I have a file : emp.txt 21356 suresh 12/12/2012 23511 ramesh 11/06/2011 31456 biswajit 09/08/2013 53134 archan 06/02/2009 first field:- employee id, 2nd field is name and third field is date of joining ... (10 Replies)
Discussion started by: shellscripting
10 Replies

14. Programming

Wildcard Pattern Matching In C

I've been having problems lately trying to do pattern matching in C while implementing wildcards. Take for instance the following code: #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <dirent.h> #include <string.h> ... (14 Replies)
Discussion started by: Azrael
14 Replies

15. Shell Programming and Scripting

Regex negative look and bash script

My script have to read logfile, and take some action, if in pattern are strings: 1) exit 0 strings pattern ... "INF - Status"... success 2) exit 1 (! as not) strings pattern ... "INF - Status"... !success Simple example, what works #!/bin/bash tail -f regex.log | while read LOGLINE ... (7 Replies)
Discussion started by: kvaikla
7 Replies