Re: Trouble with grep
On 5/2/2008 4:08 PM, Ryan wrote:
> On May 2, 5:05 pm, Ed Morton <mor...@lsupcaemnt.com> wrote:
>
>>On 5/2/2008 4:01 PM, Ryan wrote:
>>
>>
>>
>>
>>>On May 2, 4:56 pm, Ed Morton <mor...@lsupcaemnt.com> wrote:
>>
>>>>On 5/2/2008 3:47 PM, Ryan wrote:
>>>
>>>>>On May 2, 4:41 pm, OldSchool <scott.my...@macys.com> wrote:
>>>>
>>>>>>On May 2, 4:22 pm, Ryan <ryan.fairch...@gmail.com> wrote:
>>>>>
>>>>>>>This is driving me nuts i am trying to use the following:
>>>>>>
>>>>>>>find . -exec grep -l "[0-9]\+\." '{}' \;
>>>>>>
>>>>>>>to find all files that have a number before a "."
>>>>>>
>>>>>>>It matches both somefile_ 1.mp3 AND somefile_ .mp3.
>>>>>>
>>>>>>>Why is this and can you suggest a better pattern? I a=only want to
>>>>>>>match the first result above.
>>>>>>
>>>>>>find <path> -name '*[0-9]\.*]
>>>>>
>>>>>>your example finds everything and runs grep on it?????
>>>>>
>>>>>This is within a certain directory
>>>>
>>>>Then add "-maxdepth 1", or use "ls" instead of "find". Depends what you want to
>>>>do with matching sub-directories and/or your other requirements.
>>>
>>>> Ed.
>>>
>>>Maybe I should explain the ultimate outcome here. I have a bunch of
>>>duplicate mp3 files that all follow "song 1.mp3", originals are of the
>>>forms "song.mp3". I simply want to find them and delete them. Am I
>>>in the right direction here.
>>
>>In the original, can "song" end in a number?
>>
>>If so, can "song" contain a space before the number?
>>
>>Do the duplicate files all end in "<space><number[s]>.mp3"?
>>
>> Ed.
>
>
> The original might end in a number however the duplicates have had
> [space]1 added before (.mp3|m4a).
Then just do:
ls *\ 1.mp3 *\ 1.m4a
and if you're sure that's the list you want to remove, replace "ls" with "rm".
Ed
|