Sponsored Content
Top Forums Shell Programming and Scripting Ls help: ls not working with start character search (^) Post 302786001 by Yoda on Tuesday 26th of March 2013 04:06:52 PM
Old 03-26-2013
You can also use:
Code:
ls -l !(a)+(bc)

From KSH manual:
Code:
           ?(pattern-list)     Optionally matches any one of the given
                               patterns.

           *(pattern-list)     Matches zero or more occurrences of the given
                               patterns.

           +(pattern-list)     Matches one or more occurrences of the given
                               patterns.

           @(pattern-list)     Matches exactly one of the given patterns.

           !(pattern-list)     Matches anything, except one of the given
                               patterns.

This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Working out end time from start + elapsed

Hi, I'm writing a script and have become stuck trying to define a variable (COMP) by adding an elapsed time (ELAPSE e.g 00:55) to a start time (START e.g 23:50). Can anybody give me a solution as to how I can get a completion time in hh:mm from the variables above? thanks Richard (4 Replies)
Discussion started by: rik1551
4 Replies

2. Shell Programming and Scripting

read a string from its end to its start and stop when you find a specific character

How can I do this? Actually I have a file which contains a path e.g. /home/john/Music/hello.mp3 and I want to take only the filename (hello.mp3) So, I need to read the file from its end to its start till the character "/" Is this possible? Thanks, I am sure you'll not disappoint me here! Oh,... (9 Replies)
Discussion started by: hakermania
9 Replies

3. Solaris

Solaris 10, start inetd in a zone not working

Hello all, I`ve the following problem - I cannot start inetd in any way possible: bash-3.00# svcs inetd STATE STIME FMRI offline Jul_30 svc:/network/inetd:default bash-3.00# bash-3.00# svcadm enable -r inetd bash-3.00# svcs inetd STATE STIME FMRI... (6 Replies)
Discussion started by: click
6 Replies

4. Slackware

pppoe-start not working

Hello. I'm new here and i'm new to slack (concept) as well. I made a connection for pppoe with pppoe-setup, bringed up eth0 with ifconfig but when i try pppoe-connect i get "Cannot determine ethernet address for proxy ARP" and with pppoe-start i get "child pppd process terminated". How can i make... (0 Replies)
Discussion started by: editheraven
0 Replies

5. Shell Programming and Scripting

escape character not working

I need to change a pattern with single quotes # echo "serversignature: 'On'" serversignature: 'On' I did # echo "serversignature: 'On'" | sed 's/.*serversignature.*/serversignature: 'Off'/' serversignature: Off The output I need is with single quotes. But its swallowing it. ... (2 Replies)
Discussion started by: anilcliff
2 Replies

6. Shell Programming and Scripting

How to start working with GNU PLOT??

Dear Experts, I wanted to plot a graph with respect to values from a file. I'm doing it with Excel 2007, but I want to create the chart in script itself. I searched in internet for GNUPLOt. But I couldn't understand anything. Here is my situation. I have a file having values separated by "|".... (7 Replies)
Discussion started by: Naga06
7 Replies

7. Shell Programming and Scripting

how to specify start and stop of a search string

I am trying to extract a string from a line of text. Currently I am using grep -o 'startofstring(.........' The string is not always the same size. The string I'm trying to extract starts with 'test(' ends with ')'. ex "blah,blah,blah,test(stringoftext),blah blah" How do I... (4 Replies)
Discussion started by: jeepguy
4 Replies

8. UNIX for Dummies Questions & Answers

Appending a character(#) with string search at the start of the line

Hello, I have been browsing through the forum, but unable to find a solution for my requirement. I need to go through a file and search for /home/users and insert a # symbol at the start /home/users. Example output is #/home/users. Can you please help me with the awk or sed command for... (1 Reply)
Discussion started by: chandu123
1 Replies

9. Shell Programming and Scripting

Perl - start search by using search button or by pressing the enter key

#Build label and text box $main->Label( -text => "Input string below:" )->pack(); $main->Entry( -textvariable => \$text456 )->pack(); $main->Button( -text => "Search", -command => sub { errchk ($text456) ... (4 Replies)
Discussion started by: popeye
4 Replies

10. Shell Programming and Scripting

How can I search with start and end criteria?

Hello I'm using cygwin and wouldlike extract information from an xml file according specific values, but don't know how. Let's say in a file content looks like this: <tab> SURNAME=Mustermann NAME=Max CUSTOMER SINCE= 18.01.2000 ADDRESS=Birmingham ... (2 Replies)
Discussion started by: witchblade
2 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 07:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy