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
glob(n) 						       Tcl Built-In Commands							   glob(n)

__________________________________________________________________________________________________________________________________________________

NAME
glob - Return names of files that match patterns SYNOPSIS
glob ?switches? pattern ?pattern ...? _________________________________________________________________ DESCRIPTION
This command performs file name ``globbing'' in a fashion similar to the csh shell. It returns a list of the files whose names match any of the pattern arguments. If the initial arguments to glob start with - then they are treated as switches. The following switches are currently supported: | -directory directory | Search for files which match the given patterns starting in the given directory. This allows searching of directories whose name | contains glob-sensitive characters without the need to quote such characters explicitly. This option may not be used in conjunction | with -path. | -join | The remaining pattern arguments are treated as a single pattern obtained by joining the arguments with directory separators. -nocomplain Allows an empty list to be returned without error; without this switch an error is returned if the result list would be empty. | -path pathPrefix | Search for files with the given pathPrefix where the rest of the name matches the given patterns. This allows searching for files | with names similar to a given file even when the names contain glob-sensitive characters. This option may not be used in conjunc- | tion with -directory. | -types typeList | Only list files or directories which match typeList, where the items in the list have two forms. The first form is like the -type | option of the Unix find command: b (block special file), c (character special file), d (directory), f (plain file), l (symbolic | link), p (named pipe), or s (socket), where multiple types may be specified in the list. Glob will return all files which match at | least one of the types given. | The second form specifies types where all the types given must match. These are r, w, x as file permissions, and readonly, hidden | as special permission cases. On the Macintosh, MacOS types and creators are also supported, where any item which is four characters | long is assumed to be a MacOS type (e.g. TEXT). Items which are of the form {macintosh type XXXX} or {macintosh creator XXXX} will | match types or creators respectively. Unrecognised types, or specifications of multiple MacOS types/creators will signal an error. | The two forms may be mixed, so -types {d f r w} will find all regular files OR directories that have both read AND write permis- | sions. The following are equivalent: | glob -type d * | glob */ | except that the first case doesn't return the trailing ``/'' and is more platform independent. | -- Marks the end of switches. The argument following this one will be treated as a pattern even if it starts with a -. The pattern arguments may contain any of the following special characters: ? Matches any single character. * Matches any sequence of zero or more characters. [chars] Matches any single character in chars. If chars contains a sequence of the form a-b then any character between a and b (inclu- sive) will match. x Matches the character x. {a,b,...} Matches any of the strings a, b, etc. As with csh, a ``.'' at the beginning of a file's name or just after a ``/'' must be matched explicitly or with a {} construct. In addi- tion, all ``/'' characters must be matched explicitly. If the first character in a pattern is ``~'' then it refers to the home directory for the user whose name follows the ``~''. If the ``~'' is followed immediately by ``/'' then the value of the HOME environment variable is used. The glob command differs from csh globbing in two ways. First, it does not sort its result list (use the lsort command if you want the list sorted). Second, glob only returns the names of files that actually exist; in csh no check for existence is made unless a pattern contains a ?, *, or [] construct. PORTABILITY ISSUES
Unlike other Tcl commands that will accept both network and native style names (see the filename manual entry for details on how native and network names are specified), the glob command only accepts native names. Windows For Windows UNC names, the servername and sharename components of the path may not contain ?, *, or [] constructs. On Windows NT, if pattern is of the form ``~username@domain'' it refers to the home directory of the user whose account information resides on the specified NT domain server. Otherwise, user account information is obtained from the local computer. On Windows 95 and 98, glob accepts patterns like ``.../'' and ``..../'' for successively higher up parent directories. Macintosh When using the options, -dir, -join or -path, glob assumes the directory separator for the entire pattern is the standard ``:''. When not using these options, glob examines each pattern argument and uses ``/'' unless the pattern contains a ``:''. SEE ALSO
file(n) KEYWORDS
exist, file, glob, pattern Tcl 8.3 glob(n)
All times are GMT -4. The time now is 04:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy