1

I am printing name of files in directory but they are coming with space separated I want them to be comma separated. My file format is (publishfile.txt)

drwxrwx---+ h655201 supergroup 0 2019-04-24 09:16 /data/xyz/invisible/se/raw_data/sample 
drwxrwx---+ h655201 supergroup 0 2019-04-24 09:16 /data/xyz/invisible/se/raw_data/sample(1)

I want them to print like sample, sample(1)

My code for that is given below but it prints with space separated rather than comma separated

File=$(awk -F / '{ print $NF }' "$BASE_PATH/publishfile.txt") 
echo File

O/P I'm getting is

Sample Sample(1) 
Shivam Sharma
  • 517
  • 1
  • 5
  • 19

1 Answers1

0

You can use printf:

File=$(awk -F / '{ printf "%s, ", $NF }' "$BASE_PATH/publishfile.txt") 
echo $File
NULL SWEΔT
  • 1,827
  • 2
  • 11
  • 13