I am trying to use find -exec with multiple commands without any success. Does anybody know if commands such as the following are possible?
find *.txt -exec echo "$(tail -1 '{}'),$(ls '{}')" \;
Basically, I am trying to print the last line of each txt file in the current directory and print at the end of the line, a comma followed by the filename.
find
manual page:There are unavoidable security problems surrounding use of the -exec option; you should use the -execdir option instead.
unixhelp.ed.ac.uk/CGI/man-cgi?find