How To Combine File Names From find Output Into A String

Using find it is trivial to lookup all files with a particular pattern:

find . -name *.jar

How do I combine the results of that command (e.g. all of the filenames) into a single string separated by a :?

The expected result would look something like:

"./foo.jar:./bar.jar"

Thank you in advance for your consideration and response.

Answer

find . -name *.jar -printf '%P:'

Leave a Reply

Your email address will not be published. Required fields are marked *