change mac address format from “-” to “:”
I want a bash script to change a mac id format. Im getting MAC IDs from windows like this
“AA-BB-CC-DD-EE-FF” using command “getmac” Now I want this to convert this format to “AA:BB:CC:DD:EE:FF” for some other use. How can I change this using a bash script?
We can use ” sed ” command for this .
#!/bin/bash
read -p “Enter MAC ADDRESS : ” mac
echo “$mac” | sed ‘s/-/:/g’
Was this answer helpful?
LikeDislike