![](https://seccdn.libravatar.org/avatar/a2b9bcad886e052ad27de5e95196d01b.jpg?s=120&d=mm&r=g)
Hi, On some occasions I have had to type a very long command that is not in the history file or access multiple file with a common character. ie files aa, ab, ac, ad, ae, af What character could I use to simulate wild cards similar to the DOS * ie $> cp /home/a* /home/hylton/ appreciated -- The wildcard Little Helper ======================================================================== Hylton Conacher - Linux user # 229959 at http://counter.li.org Currently using SuSE 9.0 Professional with KDE 3.1 Licenced Windows user ========================================================================
![](https://seccdn.libravatar.org/avatar/0cbaa079ca2ee8e16331bf6fffc796c4.jpg?s=120&d=mm&r=g)
Hylton Conacher (ZR1HPC) wrote:
Hi,
On some occasions I have had to type a very long command that is not in the history file or access multiple file with a common character.
ie files aa, ab, ac, ad, ae, af
What character could I use to simulate wild cards similar to the DOS * ie
$> cp /home/a* /home/hylton/
appreciated
Is there any reason * won't work for you here? * matches 0 or more characters. Ie, a* would match a, ab, abc, and abcd. ? matches 1 character. Ie, a? would match ab, ac, aa, etc, but not a, abc or abcd. You might do a google search for "linux glob" for more information. Steve
![](https://seccdn.libravatar.org/avatar/b12cfb65ca4faebc3e3aac17838e8f8d.jpg?s=120&d=mm&r=g)
Hylton, On Wednesday 10 November 2004 11:02, Steve wrote:
Hylton Conacher (ZR1HPC) wrote:
Hi,
On some occasions I have had to type a very long command that is not in the history file or access multiple file with a common character.
ie files aa, ab, ac, ad, ae, af
What character could I use to simulate wild cards similar to the DOS * ie
...
Is there any reason * won't work for you here?
* matches 0 or more characters. Ie, a* would match a, ab, abc, and abcd. ? matches 1 character. Ie, a? would match ab, ac, aa, etc, but not a, abc or abcd.
- * matches 0 or more occurrences of any character (as Steve said) - ? matches exactly one occurrence of any character - [abc] [A-Z] Matches once occurrence of any of the characters enclosed in square brackets. Ranges (based on unicode character codes) are denoted with hyphens. To get a hyphen, place it first. The character class is inverted if the first character is the up-arrow, '^'. Keep in mind, too, that there is a way to generate arguments that are not tied to file names, as the aforementioned "glob" patterns are. To do this, use the {curly,brace} notation: % echo left-{middle1,middle2,middle3}-right left-middle1-right left-middle2-right left-middle3-right This notation can be nested, too: % echo left-{middle{1,2,3}}-right left-middle1-right left-middle2-right left-middle3-right
Steve
Randall Schulz
![](https://seccdn.libravatar.org/avatar/9e9cd0ac4b9e1e8633e84a8070485076.jpg?s=120&d=mm&r=g)
On Wednesday 10 November 2004 8:27 am, Hylton Conacher (ZR1HPC) wrote:
Hi,
On some occasions I have had to type a very long command that is not in the history file or access multiple file with a common character.
ie files aa, ab, ac, ad, ae, af There are very specific rules to the use of wild cards with files in Unix and of regular expressions. file a[abcdef] matches aa, ab, ac, ae, af.
Please note that expressions used to match files use the question mark as a
single character wild card where regular expressions use the period. There
are many resources for regular expressions, and they are a defined POSIX
standard. (Basic Regular expressions and Extended Regular Expressions)
Here is one for files:
http://cc.uoregon.edu/unixhelp/concepts/regexp1.1.html
Here is one for REs:
http://sitescooper.org/tao_regexps.html
--
Jerry Feldman
![](https://seccdn.libravatar.org/avatar/ba86f283d614d2cd9b6116140eaddded.jpg?s=120&d=mm&r=g)
Hylton Conacher (ZR1HPC) wrote:
Hi,
On some occasions I have had to type a very long command that is not in the history file or access multiple file with a common character.
ie files aa, ab, ac, ad, ae, af
What character could I use to simulate wild cards similar to the DOS * ie
$> cp /home/a* /home/hylton/
Well, you could try characters such as * and ?. They tend to work well. Also, you may want to read up on the bash shell for lots of possible techniques. There's a lot more available, than in DOS.
![](https://seccdn.libravatar.org/avatar/41ed85ec60b719fa1654d12375dd9bd6.jpg?s=120&d=mm&r=g)
On Wed, 2004-11-10 at 08:27, Hylton Conacher (ZR1HPC) wrote:
Hi,
On some occasions I have had to type a very long command that is not in the history file or access multiple file with a common character.
ie files aa, ab, ac, ad, ae, af
What character could I use to simulate wild cards similar to the DOS * ie
$> cp /home/a* /home/hylton/
appreciated
Wildcards at the cli... * matches all characters - *.pl ? matches any single character - som?file.pl [a,b,d-f] matches single and ranges of characters - som[e,E]file[0-9,1-5].pl Hope this helps a little. -- Ken Schneider UNIX since 1989 SuSE since 1998 * Only reply to the list please*
![](https://seccdn.libravatar.org/avatar/a2b9bcad886e052ad27de5e95196d01b.jpg?s=120&d=mm&r=g)
Hylton Conacher (ZR1HPC) wrote:
Hi,
On some occasions I have had to type a very long command that is not in the history file or access multiple file with a common character.
ie files aa, ab, ac, ad, ae, af
What character could I use to simulate wild cards similar to the DOS * ie
$> cp /home/a* /home/hylton/
DOH!!! It works. Forget the question. Must have been another point I was trying to bring across but have forgotten. -- The corrected Little Helper ======================================================================== Hylton Conacher - Linux user # 229959 at http://counter.li.org Currently using SuSE 9.0 Professional with KDE 3.1 Licenced Windows user ========================================================================
participants (6)
-
Hylton Conacher (ZR1HPC)
-
James Knott
-
Jerry Feldman
-
Ken Schneider
-
Randall R Schulz
-
Steve