Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove colons from a list of MAC addresses?

Tags:

regex

I'm having a hard time trying to remove the colons in a list of MAC addresses.

My file:

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

Expected Output:

00215A2862BF
0024810A0444
like image 717
nmuntz Avatar asked May 07 '09 20:05

nmuntz


2 Answers

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

cat file | sed s/://g

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

sed s/://g file
like image 185
andri Avatar answered Oct 19 '22 10:10

andri


perl -pe "s/://g" yourfile
like image 22
Sinan Ünür Avatar answered Oct 19 '22 11:10

Sinan Ünür