![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read metacharacter [ and ] | kamel.seg | Shell Programming and Scripting | 2 | 01-15-2008 10:21 AM |
| compare null with non-null | nitin | Shell Programming and Scripting | 8 | 11-04-2006 04:58 PM |
| Null Value | Khoomfire | UNIX for Advanced & Expert Users | 1 | 04-10-2006 06:55 AM |
| Q1 :/dev/null Q2 -A | big123456 | UNIX for Advanced & Expert Users | 4 | 11-09-2005 11:16 PM |
| >/dev/null | piltrafa | UNIX for Dummies Questions & Answers | 1 | 10-26-2001 02:46 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Null metacharacter?
Ok, here's what I'm trying to do:
I'm trying to formulate an <expression> that will match any of the following: *.jpeg *.jpg *.JPEG *.JPG for a 'find <directory> -name <expression> ' command. I'd like to do *.[jJ][pP][eE<null>][gG], but don't know what the null character is, or even if it exists. Any thoughts on how to implement this? Thanks. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
how about
find . -name "*.[jJ][pP]*[gG]"
__________________
War doesnt determine who is right, it determines who is left |
|
#3
|
|||
|
|||
|
Sure, I thought about that, but that would match *.jpig, *.jpog, *.jpanythingyouwantg, etc. I'm looking for a more exact expression. Obviously your suggestion would work 99.999999% of the time though. I think an even better one would be *.[jJ][pP]?[gG] since ? restricts the wildcard to a single character, but still not quite what I'm looking for.
|
|
#4
|
|||
|
|||
|
I'm not sure why you think you need this, ASCII NUL is the end of a string. The dirent struct member d_name is a char *. So it will be interpreted as ending with the character before the NUL.
the null character is Code:
\000 |
|
#5
|
||||
|
||||
|
Quote:
|
|
#6
|
|||
|
|||
|
try : (space)
Code:
\b |
|
#7
|
||||
|
||||
|
There is no null character in file pattern-matching
Code:
find <directory> -name '*.[jJ][pP][gG]' -o -name '*.[jJ][pP][eE][gG]' |
||||
| Google The UNIX and Linux Forums |