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.10 29 Dec 1996 gmatch(3GEN)
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)
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)
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)
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)
i'm puzzled....
trying to look for the pattern }"'. but the below code returns to me the message below (pattern is curley queue + dbl qt + sng qt + period)
nawk -v pat="\}\"\'\."'
{
if (match($0, pat)) {
before = substr($0,1,RSTART-1);
... (11 Replies)
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)
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)
I couldn't figure out how to use sed or any other shell to do the following. Can anyone help? Thanks.
If seeing a string (e.g., TODAY) in the line,
replace a string in the line above (e.g, replace "Raining" with "Sunny")
and replace a string in the line below (e.g., replace "Reading" with... (7 Replies)
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)
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)
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)
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)
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)
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)
Hello all, I can get close to what I am looking for but cannot seem to hit it exactly and was wondering if I could get your help.
I have the following sample from textfile with many thousands of lines: File 1
PS001,001 HLK
PS002,004 L<G
PS004,002 XNN
PS004,006 BVX
PS004,006 ZBX=... (7 Replies)