My Question is, I have 2 columns. The text in the secound column has comma seperated values. I want the 2 columns to be deisplayed as comma seperated and the comma seperated text in 2nd column should remain as it is.
E.g: A,B being the name of the columns:
A B
123 Hi There
234 Hello there
I want the output as
A,B
123,Hi There
234,Hellothere
Can someone please help me?
You can use this sed
command
sed -r 's/\s+/,/' File_Name
or
sed -r 's/ +/,/' File_Name
-r, --regexp-extended
use extended regular expressions in the script.
Output :
A,B
123,Hi There
234,Hello there
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With