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



Question:

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  

Any ideas on how could I do this? Thanks a lot in advance.


Solution:1

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  


Solution:2

perl -pe "s/://g" yourfile  


Solution:3

echo "00:21:5A:28:62:BF" | sed -e 's/://g'  00215A2862BF  


Solution:4

tr -d ':' < file

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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »