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? Perhaps it makes sense to start small, without variable substitution, and go from there when you know you're getting what you want. Cheers -- tomás
signature.asc
Description: Digital signature