Skip to main content
Tweeted twitter.com/StackUnix/status/1050581988640546816
Source Link
Duck
  • 4.8k
  • 19
  • 55
  • 72

Replacing just the first occurence of a character in a line

I have a line with thousands of lines like this:

{"100K";"0.00001";"10";"0.01"]} {"101K";"0.0001";"100";"0.1"]} {"102K";"1";"1000";"1"]} {"102K";"1";"1000";"1"]} {"103K";"0.01";"10000";"10"]} {"104K";"0.1";"100000";"100"]} {"105K";"1";"1000000";"1000"]} {"109K";"0.000001";"1";"1"]} {"120K";"0.000012";"12";"12"]} 

I want to replace the first occurrence of ; in a line with :[

Making these lines equal to

{"100K":["0.00001";"10";"0.01"]} {"101K":["0.0001";"100";"0.1"]} {"102K":["1";"1000";"1"]} {"102K":["1";"1000";"1"]} {"103K":["0.01";"10000";"10"]} {"104K":["0.1";"100000";"100"]} {"105K":["1";"1000000";"1000"]} {"109K":["0.000001";"1";"1"]} {"120K":["0.000012";"12";"12"]} 

how do I do that with sed or other unix command?