Simple list question

Hi,

Can someone tell me how to do this...

I want to concatenate a list of files with a ':' using the find command...

I have tried

find ${dir} -type f -print | sed 's/$/:/g'

but what this does is only append a ':' to the end of the file instead of removing the new line and concatenating the list... :wall: preferably a one liner as currently I am having loop through a list of files using the find command and appending the file to a variable followed by a ':' which is slow...

 
find  ${dir} -type f -print | while read a; do echo -n "$a:"; done
1 Like

Or maybe with:

find ${dir} -type f -print | awk 1 ORS=:
1 Like

Excellent! Thanks...knew it would be simple... :rolleyes:

Hi,

another way:

VAR=$(find ${dir} -type f -exec echo  \"{}\"\: \; ) 
1 Like

try this :wink: [ GNU find ]

$ find ${dir} -type f -printf "%p:"