Am Sat, 23 Aug 2003 22:59:07 +0000 schrieb John McQuillen:
> On Sat, 2003-08-23 at 10:32, Udo Rader wrote:
>> 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}
>>
>
> 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
thanks john,
your idea looks quite interesting, though it ends when the filename has
more than one character.
say I have
/opt/too_many_files/secret
/opt/too_many_files/top_secret
/opt/too_many_files/confidential
/opt/too_many_files/public
and don't want to copy top_secret, your idea does not work:
% ls /opt/too_many_files/*[^top_secret]
but digging through the ls manpage I found a solution:
% ls --ignore="top_secret" /opt/too_many_files
udo
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com