is there a command such as "sed" in bash scripts in c++? : Currently ım trying to convert my bash script to c++ executable

but ı stuck in "sed" command

here is my bash script:

    unset WIFIMAC
    unset BTMAC
    
    # Skip processing if MAC addresses are already written
    if [ -f /data/.mac.info -a -f /data/.bt.info ]; then
    	echo "MAC addresses already found."
    fi
    
    # Wait until Samsung's RIL announces MAC addresses
    until [ $(expr length "$WIFIMAC") == 17 ]; do
    	WIFIMAC=`getprop ril.wifi_macaddr`
    	sleep 1
    done
    
    until [ $(expr length "$BTMAC") == 12 ]; do
    	BTMAC=`getprop ril.bt_macaddr`
    	sleep 1
    done
    
    # Set WiFi MAC address
    echo $WIFIMAC >/data/.mac.info
    
    # Convert BT MAC address to proper format
    echo $BTMAC | sed 's!^M$!!;s!\-!!g;s!\.!!g;s!\(..\)!\1:!g;s!:$!!' >/data/.bt.info
    
    exit

here ım trying it to convert to c++
*** ı put comments into next of bash commands ***

    # This script will read the MAC addresses from Samsung's RIL.
    
    unset WIFIMAC    --->      char wifimac....
    unset BTMAC      --->      char btmac...
    
    # Skip processing if MAC addresses are already written
    if [ -f /data/.mac.info -a -f /data/.bt.info ]; then    ----> create file_exist(); function with fd = open... and put a smiply if return block
    	echo "MAC addresses already found."
    fi
    
    # Wait until Samsung's RIL announces MAC addresses
    until [ $(expr length "$WIFIMAC") == 17 ]; do           -----> while strlen(wifimac) == 17 blah blah blah....
    	WIFIMAC=`getprop ril.wifi_macaddr`              -----> property_get function in cutils.h 
    	sleep 1                                         -----> mdelay(1) if ım not wrong huh?.....
    done
    
    until [ $(expr length "$BTMAC") == 12 ]; do
    	BTMAC=`getprop ril.bt_macaddr`                  -----> SAME COMMANDS ABOVE
    	sleep 1
    done
    
    # Set WiFi MAC address
    echo $WIFIMAC >/data/.mac.info                          -----> create write_string_to_path(); function with write(fd, ...)
    
    # Convert BT MAC address to proper format
    echo $BTMAC | sed 's!^M$!!;s!\-!!g;s!\.!!g;s!\(..\)!\1:!g;s!:$!!' >/data/.bt.info -----> ********HERE İS THE F*CKİNG COMMAND "sed" *********
                                                                                                     I KNOW A LİTTLE BİT ABOUT SED
                                                                                                     BUT I DONT KNOW WHAT İS İT DOİNG HERE
                                                                                                     THUS I DONT KNOW WHİCH COMMAND İN C++ DO THE SAME THİNG
    
    exit

can any one help me please?

thanx
regards