home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!auspex-gw!guy
- From: guy@Auspex.COM (Guy Harris)
- Newsgroups: comp.unix.questions
- Subject: Re: A question on ls
- Message-ID: <14370@auspex-gw.auspex.com>
- Date: 30 Aug 92 01:13:02 GMT
- References: <6786@tekig7.PEN.TEK.COM> <1992Aug29.233534.27967@umbc3.umbc.edu> <1992Aug29.235425.26762@mcc.com>
- Sender: news@auspex-gw.auspex.com
- Distribution: na
- Organization: Auspex Systems, Santa Clara
- Lines: 23
- Nntp-Posting-Host: auspex.auspex.com
-
- >Not true, this should work in ALL shells:
- >
- >ls | grep -v '.Z'
-
- Nope:
-
- bootme$ ls
- alakaZam
- bootme$ ls | grep -v '.Z'
-
- Jim Davis's version is better; he suggested
-
- ls | grep -v '\.Z$'
-
- The '\' in front of the '.' tells "grep" (or "egrep") that the "." isn't
- a single-character "wildcard" that'll match any character, but is
- supposed to match only the character '.'. The '$' at the end tells
- "grep" (or "egrep") that it's supposed to match stuff that has '.Z' at
- the end, not stuff that has '.Z' in the middle.
-
- That keeps it from matching "alakaZam", for example, which *does* match
- '.Z'; the '.' matches the 'a' before the 'Z', and it doesn't care if the
- 'Z' is at the end.
-