Sponsored Content
Top Forums Shell Programming and Scripting Find string in list with wildcards Post 302329010 by vgersh99 on Thursday 25th of June 2009 05:32:26 PM
Old 06-25-2009
Quote:
Originally Posted by scottn
I'm only going to guess (and it's probably not a good guess) that the ksh88 on Solaris is "older" (read as slightly different) than the ksh88 on whatever "nix you compared it to.

The ksh on AIX is not the same as on Solaris. There are subtle, but very minor differences (all of which I have momentarily - and somewhat conveniently forgotten!)
Do you have access to AIX? Could you try it, please.
It does not work with '/usr/xpg4/bin/sh' either ........

---------- Post updated at 05:32 PM ---------- Previous update was at 05:31 PM ----------

Quote:
Originally Posted by Johan III
I am working with a /bin/sh script file on a Linux nemi 2.4.25 PPC system.
Your '/bin/sh' on Linux might actually be ksh or bash 'in disguise' - try it.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help--Using wildcards in string comparison

Hi, I want to compare two strings using wild cards. In the file run_test i have if ; then cp ../stimulus/default_value.in ../log/$1.log fi When I issue the command run_test i2c_default_test in the command line, the cp command is not executed. Whereas if i give the following code,... (2 Replies)
Discussion started by: deepae
2 Replies

2. Shell Programming and Scripting

Help to find string and return following characters from list of files

Hi, I'm fairly new to UNIX, but hopefully some-one can help me with this: I am using the following code to find files with the name "example.xml": find . -name "example.xml" -print that would print me a list like the example here: ./dir1/dir2/example.xml... (5 Replies)
Discussion started by: boijie
5 Replies

3. Homework & Coursework Questions

Need help using find or locate with wildcards

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: List all files in ~c12100 directory beginning with "BOZO" that end with either "123" or "456" 2. Relevant... (3 Replies)
Discussion started by: ScarletRavin
3 Replies

4. Linux

Find String in FileName and move the String to new File if not found

Hi all, I have a question.. Here is my requirement..I have 500 files in a path say /a/b/c I have some numbers in a file which are comma seperated...and I wanted to check if the numbers are present in the FileName in the path /a/b/c..if the number is there in the file that is fine..but if... (1 Reply)
Discussion started by: us_pokiri
1 Replies

5. Shell Programming and Scripting

find string(s) in text file and nearby data, export to list help

Hi, So I'm kinda new to shell scripts and the like. I've picked up quite a bit of use from browsing the forums here but ran into a new one that I can't seem to find an answer for. I'm looking to parse/find a string AND the next 15 or so charachters that follow the string within a text file... (1 Reply)
Discussion started by: kar23me
1 Replies

6. UNIX for Dummies Questions & Answers

Find the list of filenames that have the string 31 at 4th and 5th position

Hi, Can anyone let me know the command to know the list of filenames that have string 31 in their 4th and 5th positions inside the file: grep -l "31" main*.txt The above grep lists all the files which have 31 at any position but I want filenames having 31 at position 4 and position 5. (8 Replies)
Discussion started by: okkadu
8 Replies

7. UNIX for Dummies Questions & Answers

[Solved] Wildcards used in find, ls and grep commands

Platforms : Solaris 10 and RHEL 5.6 I always get double quotes , single quotes and asteriks mixed up for find, ls and grep commands. The below commands retrieve the correct results. But , unders stress , I get all these mixed up :mad: .So, i wanted to get a clear picture. Please check if... (7 Replies)
Discussion started by: John K
7 Replies

8. Shell Programming and Scripting

Grep string in files and list file names that contain the string

Hi, I have a list of zipped files. I want to grep for a string in all files and get a list of file names that contain the string. But without unzipping them before that, more like using something like gzcat. My OS is: SunOS test 5.10 Generic_142900-13 sun4u sparc SUNW,SPARC-Enterprise (8 Replies)
Discussion started by: apenkov
8 Replies

9. UNIX for Dummies Questions & Answers

Find command and use of wildcards

greetings, below is the find command i am using for some filesystem maintenance: find /data/Engine \( -type d -name .snapshot -prune -o -type d -wholename "/data/Engine/*/CAE" \ -prune -o -type d -wholename "/data/Engine/*/CAD" -prune -o -name ".*.case" \)\ -mtime +365 -print0 -fls... (5 Replies)
Discussion started by: crimso
5 Replies

10. Shell Programming and Scripting

Find string in file and find the all records by string

Hello I would like to get know how to do this: I got a big file (about 1GB) and I need to find a string (for instance by grep ) and then find all records in this file based on a string. Thanks for advice. Martin (12 Replies)
Discussion started by: mape
12 Replies
FNMATCH(3)                                                   Linux Programmer's Manual                                                  FNMATCH(3)

NAME
fnmatch - match filename or pathname SYNOPSIS
#include <fnmatch.h> int fnmatch(const char *pattern, const char *string, int flags); DESCRIPTION
The fnmatch() function checks whether the string argument matches the pattern argument, which is a shell wildcard pattern. The flags argument modifies the behavior; it is the bitwise OR of zero or more of the following flags: FNM_NOESCAPE If this flag is set, treat backslash as an ordinary character, instead of an escape character. FNM_PATHNAME If this flag is set, match a slash in string only with a slash in pattern and not by an asterisk (*) or a question mark (?) metacharacter, nor by a bracket expression ([]) containing a slash. FNM_PERIOD If this flag is set, a leading period in string has to be matched exactly by a period in pattern. A period is considered to be leading if it is the first character in string, or if both FNM_PATHNAME is set and the period immediately follows a slash. FNM_FILE_NAME This is a GNU synonym for FNM_PATHNAME. FNM_LEADING_DIR If this flag (a GNU extension) is set, the pattern is considered to be matched if it matches an initial segment of string which is followed by a slash. This flag is mainly for the internal use of glibc and is implemented only in certain cases. FNM_CASEFOLD If this flag (a GNU extension) is set, the pattern is matched case-insensitively. FNM_EXTMATCH If this flag (a GNU extension) is set, extended patterns are supported, as introduced by 'ksh' and now supported by other shells. The extended format is as follows, with pattern-list being a '|' separated list of patterns. '?(pattern-list)' The pattern matches if zero or one occurrences of any of the patterns in the pattern-list match the input string. '*(pattern-list)' The pattern matches if zero or more occurrences of any of the patterns in the pattern-list match the input string. '+(pattern-list)' The pattern matches if one or more occurrences of any of the patterns in the pattern-list match the input string. '@(pattern-list)' The pattern matches if exactly one occurrence of any of the patterns in the pattern-list match the input string. '!(pattern-list)' The pattern matches if the input string cannot be matched with any of the patterns in the pattern-list. RETURN VALUE
Zero if string matches pattern, FNM_NOMATCH if there is no match or another nonzero value if there is an error. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------+---------------+--------------------+ |Interface | Attribute | Value | +----------+---------------+--------------------+ |fnmatch() | Thread safety | MT-Safe env locale | +----------+---------------+--------------------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008, POSIX.2. The FNM_FILE_NAME, FNM_LEADING_DIR, and FNM_CASEFOLD flags are GNU extensions. SEE ALSO
sh(1), glob(3), scandir(3), wordexp(3), glob(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU 2015-12-28 FNMATCH(3)
All times are GMT -4. The time now is 04:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy