The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
port filtering ujjwalmohan HP-UX 0 11-25-2007 09:18 PM
Filtering Data bobo UNIX for Dummies Questions & Answers 2 09-19-2007 12:06 PM
awk filtering ? varungupta UNIX for Advanced & Expert Users 4 09-16-2007 11:55 PM
Filtering Data Raynon Shell Programming and Scripting 7 09-05-2007 03:38 PM
Need help in string filtering (KSH) rockysfr Shell Programming and Scripting 1 06-27-2007 11:04 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-10-2008
Registered User
 

Join Date: Dec 2007
Location: Philippines, Cebu City
Posts: 67
awk and sed filtering

Goo afternoon Sir'sould like to ask your help reagrding in this scenario using sed and awk.

********************************************************
Host:CDRMSAPPS1
Operating System:Linux 2.6.9-42.ELsmp
Machine Type:UNIX
Host Type:Client
Version:5.1
********************************************************

Universal Settings

Restore retries: 0
Browse timeframe for restores 0 days
Required network interface

********************************************************
Host:CERDB1
Operating System:Linux 2.6.9-22.ELsmp
Machine Type:UNIX
Host Type:Client
Version:5.1
********************************************************
Universal Settings

Restore retries: 0
Browse timeframe for restores 0 days
Required network interface

****************************
this is just a test
******************************

********************************

Hostname: cebudr

********************************************************
Host:ROAM-D
Operating System:Linux 2.6.9-34.ELsmp
Machine Type:UNIX
Host Type:Client
Version:5.1
********************************************************


Desired Output :

********************************************************
Host:CDRMSAPPS1
Operating System:Linux 2.6.9-42.ELsmp
Machine Type:UNIX
Host Type:Client
Version:5.1
********************************************************

********************************************************
Host:CERDB1
Operating System:Linux 2.6.9-22.ELsmp
Machine Type:UNIX
Host Type:Client
Version:5.1
********************************************************

*******************************************************
Host:ROAM-D
Operating System:Linux 2.6.9-34.ELsmp
Machine Type:UNIX
Host Type:Client
Version:5.1
********************************************************
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-10-2008
dj -------
 

Join Date: Feb 2007
Location: Cochin, India
Posts: 332
Try this:

sed -n '/Host/,/Version/p;' filename | sed 's/Host:/\nHost/g'
Reply With Quote
  #3 (permalink)  
Old 01-10-2008
Registered User
 

Join Date: Dec 2007
Location: Philippines, Cebu City
Posts: 67
thanks sir
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0