[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, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> What part of "tell us the actual problem" did you not understand?
>
> Oh, wait.  I already know the answer to that one: all of it. :(
>
> Do you want to search for all files in ~/java whose names end with
> .java or .txt and which contain the string
> "java.io.UnsupportedEncodingException;" ?

 Yes, I do!

> Why is it so hard to write three lines of text that explain what you
> are trying to do?

 I thought the bash one liner and my rambing explained it all well.

> Anyway, here's one answer to what I *think* you are trying to achieve:
>
> find ~/java -type f \( -iname '*.java' -o -iname '*.txt' \) \
>   -exec grep -l -F 'java.io.UnsupportedEncodingException;' {} +

 But where is the  -printf '"%TD %TT",%Ts,%s,"%P"\n' part in your one liner?

 Include it:

 find ~/java -type f \( -iname '*.java' -o -iname '*.txt' \) -printf
'"%TD %TT",%Ts,%s,"%P"\n' -exec grep -l -F
'java.io.UnsupportedEncodingException;' {} +

 and you will see what I have been talking about

 lbrtchx


Reply to: