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)
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)
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)
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)
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)
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)