Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Substitution query

Status
Not open for further replies.

ranjit

Technical User
Apr 14, 2000
131
GB
Input file:

85CD3F1F:U5791.001.99B03HF-P1-C08:bpr06cd01dn:5:none:pCI 10/100/1000Mbps Ethernet UTP 2-port

Desired output:

83C3D1F:U5791:001:99B03HF:p1:C08:bpr06cd01dn:5:none:pCI 10/100/1000Mbps Ethernet UTP 2-port

Could someone assist with a substitution query. The idea is to replace the following first two characters "." and "-" ONLY to a ":"

This replaces the first occurance
sed 's/\./:/1' inputfile

Is there a method to replace the first two occurances in one hit.

Thanks
 

Code:
sed 's/\./:/;s/\./:/;s/-/:/;s/-/:/' inputfile

Jean-Pierre.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top