On Sat, 2003-08-23 at 10:32, Udo Rader wrote:
> hi,
>
> I have a directory that contains several hundred files and I want to
> copy them all except _one_ file.
>
> This sounds so easy yet still I am stuck or blind or stupid. Is there no
> "not" operator in bash?
>
> If it were, some construct like the thing below could then list all files
> in "/opt/too_many_files" except "no_not_this_one":
>
> % ls -l /opt/too_many_files/*{!no_not_this_one}
>
> Yes, I know this doesn't work, but is there any other efficient way to do
> this in bash?
You were very close...
In regular expressions, the carat (^) is used to signify the beginning
of a line, however, within square brackets it signifies 'not':
[EMAIL PROTECTED] dementis]$ mkdir test
[EMAIL PROTECTED] dementis]$ touch test/1
[EMAIL PROTECTED] dementis]$ touch test/2
[EMAIL PROTECTED] dementis]$ touch test/3
[EMAIL PROTECTED] dementis]$ touch test/4
[EMAIL PROTECTED] dementis]$ ls -la test/*[^2]
-rw-r--r-- 1 dementis dementis 0 Aug 24 08:51 test/1
-rw-r--r-- 1 dementis dementis 0 Aug 24 08:51 test/3
-rw-r--r-- 1 dementis dementis 0 Aug 24 08:51 test/4
Cheers,
John...
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com