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

Sed

Status
Not open for further replies.

sumncguy

IS-IT--Management
May 22, 2006
118
US

SunOS 5.8 Generic_117350-28 sun4u sparc SUNW,Sun-Fire-V440
running scripit in ksh

Sample data

controller T1 0/0/0
framing esf
linecode b8zs
channel-group 0 timeslots 1-24
!
controller T1 0/0/1
framing esf
linecode b8zs
channel-group 0 timeslots 1-24
!
controller T1 0/1/0
framing esf
linecode b8zs
!
controller T1 0/1/1
framing esf
linecode b8zs


sed -n '/controller T/{ N; / channel/p; }' <filename>

I have the Oreilly short book in hand ... I need another set of eyes. Not sure what Im doing wrong.

I want to output only the controller Tx lines and the channel-group lines. In the case of the above test data set

controller T1 0/0/1
channel-group 0 timeslots 1-24


Thanks

 
Something like

sed -n '/controller T/p;/channel/p' <filename>

I hope that helps.

Mike
 
Another way:
awk '/controller T/||/ channel/' filename
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top