How to remove colons from a list of MAC addresses?

It's hard for me to try to remove the colons in the MAC address list.

My file:

00:21:5A:28:62:BF 00:24:81:0A:04:44 

Expected Result:

 00215A2862BF 0024810A0444 

Any ideas on how I can do this? Thank you very much in advance.

+6
regex perl sed
source share
4 answers

Given your tags, you want to execute this in a shell:

 cat file | sed s/://g 

edit: you really don't need cat if you are reading from a file:

 sed s/://g file 
+13
source share
 perl -pe "s/://g" yourfile 
+7
source share
 echo "00:21:5A:28:62:BF" | sed -e 's/://g' 00215A2862BF 
+1
source share

tr -d ':' <file

probably will work too, although I don't have a command line to check the syntax.

+1
source share

All Articles