The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Merging of files with different headers to make combined headers file marut_ashu Shell Programming and Scripting 1 08-07-2009 05:10 AM
Remove text between headers while leaving headers intact Trones Shell Programming and Scripting 3 12-27-2008 08:06 PM
headers of the query bhagya.puccha High Level Programming 0 09-09-2008 01:55 AM
C Headers biosdos High Level Programming 0 01-22-2006 02:48 PM
kernel-headers rpm Negm Red Hat 2 04-05-2005 08:40 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-15-2009
Joel_john Joel_john is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 3
Grep Headers

Hi!

Trying to find string and then put the above Headers of corresponding fist line.

After executing a Property command a get this output:

SP/CH-CH Span Name Type TG Idle InUse OffHk OnHk Ring
-------- ------------------------------ ------ ---- ----- ----- -----
02/01-24 CARRIERSS7 505 2 22 0 0 0 1-24 12
04/01-24 CARRIERSS7 505 2 22 0 0 0 49-72 12
CH TRGP CIC Bearer BLoc-Rem CH TRGP CIC Bearer BLoc-Rem CH
-- ---- ----- -------- -------- -- ---- ----- -------- -------- -- ----
04 0 76 CARRIERISDN2511Reset H 11 505 83 Reset H 18 505 90 Reset H
05 0 77 CARRIERISDN2511Reset H 12 505 84 Reset H 19 505 91 Reset H
07 505 79 CARRIERISDN2511Reset H 14 505 86 Reset H 21 505 93 Reset H
08/01-24 CARRIERISDN2511 SS7CH TRGP CIC Bearer BLoc-Rem CH TRGP CIC
-- ---- ----- -------- -------- -- ---- ----- -------- -------- -- ----
01 511 97 Idle H M 09 511 105 Reset H 17 511 113 Reset H
02 511 98 Reset H 10 511 106 Reset H 18 511 114 Reset H


i excute a grep with in this way to filter:

Code:
 command  | grep CARRIERSS7
and get this output:

02/01-24 CARRIERSS7 505 2 22 0 0 0 1-24 12
04/01-24 CARRIERSS7 505 2 22 0 0 0 49-72 12

then i neet to bring the header above the first output line no matter whats the result.

i was thinking to store the output in a variable and then excute a second grep to find the hear and then merge in one file all together like this:

SP/CH-CH Span Name Type TG Idle InUse OffHk OnHk Ring
-------- ------------------------------ ------ ---- ----- ----- -----
02/01-24 CARRIERSS7 505 2 22 0 0 0 1-24 12
04/01-24 CARRIERSS7 505 2 22 0 0 0 49-72 12

thanx for all
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:16 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0