[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: All true assertions in a bash find one liner? ...



On 2/27/20, tomas@tuxteam.de <tomas@tuxteam.de> wrote:
> On Thu, Feb 27, 2020 at 01:40:22PM +0100, Albretch Mueller wrote:
>>  I need to find all files which names satisfy a pattern and contain a
>> certain string, then from those files I need to printf some metadata,
>> a la:
>>
>>  find "${_SDIR}" -type f -iregex .*"${_X}" -printf '"%TD
>> %TT",%Ts,%s,"%P"\n' > "${_TMPFL}" 2>&1
>>
>>  I am trying to do all steps in one go, which I think should be
>> possible, but it is not working. Tha tline prints out both all
>> patterned files using the format specified in the -printf parameter
>> and (repeatedly) those that match the search inside the content as
>> paths (no -printf).
>
> Hm. I don't get it. The general form above should work. Are you
> sure the regex isn't matching all files?

 No, it doesn't. Try it and you will see what I mean. I tried to
explain it all on the initial post

 Once you include the -printf stanza find gets a bit "crazy" if you
have also an -exec one

 lbrtchx


Reply to: