tar: wildcards

1 
1 6.5 Wildcards Patterns and Matching
1 ===================================
1 
1 "Globbing" is the operation by which "wildcard" characters, '*' or '?'
1 for example, are replaced and expanded into all existing files matching
1 the given pattern.  GNU 'tar' can use wildcard patterns for matching (or
1 globbing) archive members when extracting from or listing an archive.
1 Wildcard patterns are also used for verifying volume labels of 'tar'
1 archives.  This section has the purpose of explaining wildcard syntax
1 for 'tar'.
1 
1    A PATTERN should be written according to shell syntax, using wildcard
1 characters to effect globbing.  Most characters in the pattern stand for
1 themselves in the matched string, and case is significant: 'a' will
1 match only 'a', and not 'A'.  The character '?' in the pattern matches
1 any single character in the matched string.  The character '*' in the
1 pattern matches zero, one, or more single characters in the matched
1 string.  The character '\' says to take the following character of the
1 pattern _literally_; it is useful when one needs to match the '?', '*',
1 '[' or '\' characters, themselves.
1 
1    The character '[', up to the matching ']', introduces a character
1 class.  A "character class" is a list of acceptable characters for the
1 next single character of the matched string.  For example, '[abcde]'
1 would match any of the first five letters of the alphabet.  Note that
1 within a character class, all of the "special characters" listed above
1 other than '\' lose their special meaning; for example, '[-\\[*?]]'
1 would match any of the characters, '-', '\', '[', '*', '?', or ']'.
1 (Due to parsing constraints, the characters '-' and ']' must either come
1 _first_ or _last_ in a character class.)
1 
1    If the first character of the class after the opening '[' is '!' or
1 '^', then the meaning of the class is reversed.  Rather than listing
1 character to match, it lists those characters which are _forbidden_ as
1 the next single character of the matched string.
1 
1    Other characters of the class stand for themselves.  The special
1 construction '[A-E]', using an hyphen between two letters, is meant to
1 represent all characters between A and E, inclusive.
1 
1    Periods ('.') or forward slashes ('/') are not considered special for
1 wildcard matches.  However, if a pattern completely matches a directory
1 prefix of a matched string, then it matches the full matched string:
1 thus, excluding a directory also excludes all the files beneath it.
1 

Menu