Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

gmatch(3gen) [v7 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.10 29 Dec 1996 gmatch(3GEN)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

what left of the pattern

I have a script which loop through a directory then report any file matches the given pattern, say, the pattern is "a2006", this file would be returned a20061101.txt I would like to know how can I get the remaining of the filename, so a20061101txt - a2006 = 1101.txt Can anybody help? Thank... (2 Replies)
Discussion started by: mpang_
2 Replies

2. Shell Programming and Scripting

Compare string to a pattern

I am new to unix and need to learn how to compare a variable $subject to a string pattern. If the variable has the word "Item" in it then it should be true. How do I do this? Currently I am using the Bourne shell but I can also use Korn or Bash. I come from a Rexx background where strings are... (2 Replies)
Discussion started by: jerryte
2 Replies

3. 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

4. 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

5. Shell Programming and Scripting

Search pattern not terminated

Hi, What am i missing on line 16, when I run this I get Search pattern not terminated at count-scr.pl line 16 #!perl open(my $log, ">log-subnet.txt") or die "Could not open log: $!\n"; ##### Step 1, read subnetsopen(my $in, "<names.txt") or die "Could not open names.txt: $!\n";while(<$in>)... (3 Replies)
Discussion started by: richsark
3 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

Pattern Matching

Hello All, I would like to have your suggestions to find out whether some characters are present in the alphanumeric string. For example, i have string like 9235793579usa9485 and i want to know how to use KSH pattern matching whether it has any alphabets ( either a-z or A-Z ) in it. Thanks... (3 Replies)
Discussion started by: nram_krishna@ya
3 Replies

9. Shell Programming and Scripting

Pattern matching & storing result in variable

Hi! i'm trying to parse textfiles against a pattern and storing the result in a variable. The strings i want to get are embraced by and can occur several times in one line, so e.g. some text anything else endwhat i have so far: #!/bin/bash for f in $* do exec 3<&0 exec 0<$f ... (2 Replies)
Discussion started by: thoni
2 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