How do I replace first space with comma in UNIX -


My question is, I have 2 columns, the second column has different values ​​than the comma in the text. I want to have 2 columns separated from the comma to be demoted, and the second column should remain separate text from the comma.

Example: A is the name of the pillars:

  AB 123 Hi there 234 Hello  

As an output to me < / P>

  A, b 123, hi there 234, hellothere  

Can someone help me?

You can use this sed command

  Sed -r's / \ s + /, / 'file_name  

or

  Sed -r's / + /, /' File_Name -r, --regexp - Extended regular expressions in expanded scripts  

Output:

  A, b 123, hi there 234, hello  

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -