Re: rm files not matching (tricky) !!
> On Sat, 08 Sep 2007 20:24:38 -0700, onkar wrote:
>> I have large number of files in a directory with filenames
>> containing
>>
>> (1) numbers [0-9] and alphabets [a-z] (for e.g., one file name
>> might be 1232344saasderv while others might have name awer345345ds
>> and sdfs12312 and 1a4d56a345d3 .. any combination ) ,
>>
>> and
>>
>> (2) some files containing only digits [0-9] .
>>
>>
>> I want to write a script removing only those files that contain both
>> alphabets and digits. One trick might me to use only property (2) to
>> remove files with property (1). (this is like grep -v grep )
Axel Schlicht <meiwakudome@email.de> writes:
> You could use ls -1 to produce a list of filenames, parse this list through
> an awk / perl / sed script or a compiled program to produce another list
> containing all the file names to delete and use this list as an input for a
> shell script doing the deleting operation with a while read ... < that_list
> loop.
That brings a problem of new lines in file names.
--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>---<jid:mina86*chrome.pl>--ooO--(_)--Ooo--
|