Artificial intelligent assistant

list all c files in sub directories and their parent directory Assume I have a directory tree as follow: /home/xen/p.c /home/dan/t.c /home/jhon/l.c ... etc (many more users) I need to get comma separated (username,full path to c file) list as follow: xen,/home/xen/p.c dan,/home/dan/t.c ... etc How to do that from command line?

It would be possible to format the output using GNUfind. Assuming files are created by the user itself your command would be:


find /home/ -maxdepth 2 -type f -name '*.c' -printf '%u,%p\
'


See `man find` for more details on `printf`

You could also use the following


find /home/ -maxdepth 2 -type f -name '*.c' -exec bash -c 'n="${1%/*}"; n="${n##*/}"; echo "$n",$1' _ {} \;

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a7646266743c77a9d41111023feace0e