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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace nth to end of line with sed

Status
Not open for further replies.

rob31312

Technical User
Feb 28, 2003
1
US
How can I replace the 6th dot to the end of the line?
I'm using sed 's/\.//6' but that only deletes the 6th dot. I want to delete the 6th, 7th, 8th, to the end. I tried using sed 's/\.//6g' but I get an error.
 
post an exemple!
assumed you have:
a.b.c.d.e.f.x.y.z
s/\(.*\.\)\(.*\.\)\(.*\.\)\(.*\.\)\(.*\.\)\(.*\.\).*/\1\2\3\4\5\6/g
gives you:
a.b.c.d.e.f.
try also cut
cut -d\. -f1-6
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top