JavaRocky JavaRocky - 11 months ago 31
Bash Question

How to join multiple lines of file names into one with custom delimiter?

I would like to join the result of

ls -1
into one line and delimit it with whatever i want.

Are there any standard Linux commands I can use to achieve this?

zaf zaf

EDIT: Simply "ls -m" If you want your delimiter to be a comma

Ah, the power and simplicity !

ls -1 | tr '\n' ','

Change the comma "," to whatever you want. Note that this includes a "trailing comma"