Robin
Robin

Reputation: 159

How to remove first comma in each line and replace it with space?

I'm not much familiar with Bash scripting, but I want to do a simple process on my large text file. I need to eliminate first comma in each line and replace it with space. Here is what my text file looks like:

CAK55580,GO:0004672,GO:0004674,GO:0004713,GO:0005524,GO:0006468
CAK55582,GO:0004672,GO:0004674,GO:0004713,GO:0005524,GO:0006468
CAK55583,GO:0007165,GO:0008603

I know that I can remove the first comma in each line using sed -i.bak 's/,//' file, but I don't know how to replace it with space. Can someone help me with this?

Upvotes: 1

Views: 977

Answers (1)

tripleee
tripleee

Reputation: 189327

The stuff between the final slashes is what to replace with.

sed 's/,/ /' file

Upvotes: 4

Related Questions