Q:

Bash-shell Replace separator between specific column

input file:
cat file1.txt
^AirIfLoadProfile=1$ trafficModelPrb bitRatePerQci=0 0 0 0 0 0 0 0 0
^AirIfLoadProfile=1$ trafficModelPrb bufferStatus=1
^AirIfLoadProfile=1$ trafficModelPrb noOfArtificialUsers=0
^AirIfLoadProfile=1$ trafficModelPrb qciDistSinrHigh=0 0 0 0 0 0 0 0 0
^AirIfLoadProfile=1$ trafficModelPrb qciDistSinrLow=0 0 0 0 0 0 0 0 0
^AirIfLoadProfile=1$ trafficModelPrb qciDistSinrMedium=100 0 0 0 0 0 0 0 0
^AirIfLoadProfile=1$ trafficModelPrb ulDlRatioPerQci=0 0 0 0 0 0 0 0 0

output file:
cat file2.txt
^AirIfLoadProfile=1$;trafficModelPrb;bitRatePerQci=0 0 0 0 0 0 0 0 0
^AirIfLoadProfile=1$;trafficModelPrb;bufferStatus=1
^AirIfLoadProfile=1$;trafficModelPrb;noOfArtificialUsers=0
^AirIfLoadProfile=1$;trafficModelPrb;qciDistSinrHigh=0 0 0 0 0 0 0 0 0
^AirIfLoadProfile=1$;trafficModelPrb;qciDistSinrLow=0 0 0 0 0 0 0 0 0
^AirIfLoadProfile=1$;trafficModelPrb;qciDistSinrMedium=100 0 0 0 0 0 0 0 0
^AirIfLoadProfile=1$;trafficModelPrb;ulDlRatioPerQci=0 0 0 0 0 0 0 0 0

Replace the space separator in column 1 between column 2 , and column 2 between column 3 with semicolon. The file2 is the output .

A:

Following sed may help you in same.
sed 's/ /;/1;s/ /;/1'   Input_file

Where I am substituting the very first space in a line with ;(semi colon) and then again changing the very first space with ;(semi colon) because after first change of space in a line the 2nd space becomes 1st space now so we need to put 1st space only by doing /1 in sed command.

