dnat
1
Hi,
I want to display only the file names of the ls command with a delimiter of comma.
For example:-
ls /etc/dir/N*
gives the following output
/etc/dir/N1 /etc/dir/N2 /etc/dir/N3
I want the output as N1,N2,N3,-->Here i need the final comma also.
Also, here /etc/dir is being passed as a parameter and hence will be dynamic
Please let me know how we can implement this.
Thanks.
sysgate
2
ls --format=commas
at least on my version of ls :
he needs extra comma at the end.
Tytalus
4
/usr/bin/ls | tr "\n" ","
cassj
5
Try the "-m" switch. A "man ls" reveals:
-m fill width with a comma separated list of entries
Then just suffix your last comma. I hope that helps some.
Cheers....Cassj