GLOBAL EXPRESSIONS
Today we start a series of 2: Global Expressions and Regular
Expressions.
Not
really easy to explain but I´ll have a go at it, trying to keep
it
simple and only mentioning what the basics are. ( We use Global
expressions to search files, Regular expressions to search in
files )
Global expressions are mostly used in combination with the command
¨ls¨ ( list files ).
I
suppose you know that the ¨*¨ sign is a wild-card and can stand
for one
or more characters. The ¨?¨ is a wild-card for only 1
character. The
¨!¨ excludes the characters that follow.
Here are some examples:
This will only list the files that start with a, b, c, d or e. ( Not A
or B ! )
Will do the same but then also A, B ,C ,D and E
The files that end with: aus, bus, cus, dus and eus
Will show the files; dare, acre, mere, bare, . . . etc.
Shows files that end with ¨re¨, but not the ones on
¨are¨ or ¨bre¨
| CODE |
| $
ls *.{jpg,png,gif} |
List all the files that end with .jpg, .png and .gif
Notice the difference in { } and [ ] !!!
This
is as far as I go with Global Expressions, tomorrow we do the Regular
Expressions, that is not as straightforward as the Global ones, but as
I said before: I will do the ultimate to keep it simple !

Bruno
-- Jun 23 2003 ( Revised Dec 10 2005 ) --