Bash command to find a file and print contents

I need to find a file and print its contents
I am trying but it is not working

find -path /opt/app-root/src/.npm/_logs -type f  -name "*.log" -print

Version

$ bash -version
GNU bash, version 4.4.12(1)-release (x86_64-pc-msys)

-print as an action in find prints the file name(s) found, not their contents. First and simplest approach:

find ... -exec cat {} \;

You may need additional action to also print files' names, some empty lines, or similar.

1 Like