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

Sed - From ^ to the first occurrence 1

Status
Not open for further replies.

sumncguy

IS-IT--Management
May 22, 2006
118
0
0
US
I want to isolate the ip. How do I get sed to delete from the start of the line (^) up to and including the first period ?

52.10.206.137.156
52.10.211.16.3
52.10.213.35.1

checked Oreilly Sed and Awk Pocket ref and some cheets I hold ....

Thanks
 
sed '0,/RE/s//to_that/' file # change only the first match
Doesnt work ...
 
's/[^*\.]*/ /1'
.10.206.137.156
.10.211.16.3
.10.213.35.1
.10.213.35.4
.10.213.35.10
.10.218.253.19
.146.170.71.103

Gettin there ...
 
And what about this ?
sed 's!^[^\.]*\.!!' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 


Works great .... Thanks .. but like to understand what Im using ...

^ = line starts with
[] = match one from a set
* = match zero or one preceding
\ = literal

I just dont see how to read it ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top