I have pipe separated file. I want to strip off digits starting with ’00’ of sub id keeping rest of numbers same.
For eg:
Karen Calvert50335491|0020380050335491|ACTIVE|100|KINGSPORT|KarenCalvert50335491@charter.net|8353/3000|RESIDENTIAL|FiberNode|TENNESSEE|00:00:00:20:0f:03|EAST|423-343-9250|HSIPLUS|1826 HIGHLAND ST|Service1|MA|01602
expected o/p-
Karen Calvert50335491|20380050335491|ACTIVE|100|KINGSPORT|KarenCalvert50335491@charter.net|8353/3000|RESIDENTIAL|FiberNode|TENNESSEE|00:00:00:20:0f:03|EAST|423-343-9250|HSIPLUS|1826 HIGHLAND ST|Service1|MA|01602
Note:In this file there are some mac address also wich are satritng with ’00’
Any help appreciated.
Thanks
Using sed:
Which matches, captures and preserves the first column in
\1via^\([^|]*\)and captures the second column in\2, skipping the leading 0’s via0*\([^|]*\). Then it replaces the matched part (columns 1 and 2) with the captured parts of these columns via/\1|\2/.