Data in file:
1234567-5678907 3456789-1234563 3456789-1234567 . . . . n
Now I want the output in the below format:
1234567-5678907,3456789-1234563,3456789-1234563....n
I have used below command but I am getting an extra comma in starting:
awk -F"-" ' {printf ",%s-%s",$1,$1} END{print""}'
Please share the command that can be used in a shell script.
paste -s -d, file
– glenn jackman 21 hours agoprintf
:awk 'NR==1{printf "%s", $0};NR>1{printf ",%s", $0};END{print ""}'
– don_crissti 20 hours ago