|
Home > Archive > Unix Programming > November 2006 > Using GREP command to print two lines at a time?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Using GREP command to print two lines at a time?
|
|
| chaituonweb@gmail.com 2006-11-16, 7:20 pm |
| Hi,
Does anybody know how to use the grep command to print multiple lines?
For example i have
SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS
F4 F5 F6 F7 F8 REORG
---------------------------------------------------------------------------=
=AD----------------------
Table: SIEBEL.CX_ASSET_X
SIEBEL CX_ASSET_X_F1 146981 939 0 3 10 0 145153
47 73 16 0 0 *----
SIEBEL CX_ASSET_X_P1 146981 1086 0 3 10 0 146981
99 64 16 0 0 -----
SIEBEL CX_ASSET_X_U1 146981 1246 0 3 13 0 146981
99 64 12 0 0 -----
---------------------------------------------------------------------------=
=AD----------------------
i am trying to select Table:,SIEBLE and *---- using egrep but i am
unable to do that. I am using cat filename|egrep
'Table:|SIEBEL|"*----"' but it doesnt work.
I want to select Table and *----- at the same time so that i can run a
reorg on the indexes which has a one *.=20
THanks in advance
| |
| John Gordon 2006-11-16, 7:20 pm |
| In <1163716071.876051.194210@i42g2000cwa.googlegroups.com> chaituonweb@gmail.com writes:
> i am trying to select Table:,SIEBLE and *---- using egrep but i am
> unable to do that. I am using cat filename|egrep
> 'Table:|SIEBEL|"*----"' but it doesnt work.
Grep assigns special meaning to the * character; it means "search for any
number of the preceeding character or pattern." If you want to search
for an actual *, you must put a backslash in front of it.
Also, since the search string was already enclosed in single-quotes, the
embedded double-quotes were being literally searched for. Leave them out.
This command should work:
egrep 'Table:|SIEBEL|\*----' filename
--
John Gordon "... What with you being his parents and all,
gordon@panix.com I think that you could be trusted not to shaft
him." -- Robert Chang, rec.games.board
| |
| chaituonweb@gmail.com 2006-11-16, 7:20 pm |
| Hi John,
Thank you for the help. I have an other doubt. What to do when i have
something like the table below and i want to select some 10 lines after
Index Statistics. I want to do this several times. Like i want to
select multiple Index Statistics in the same file. Please help me with
this. I mean i have an other Index Statistics below this file as shown
below. Thanks in advance John
Index statistics:
F4: CLUSTERRATIO or normalized CLUSTERFACTOR > 80
F5: 100 * (KEYS * (ISIZE + 9) + (CARD - KEYS) * 5) / ((NLEAF - NUM
EMPTY LEAFS -1) * (INDEXPAGESIZE - 96) > MIN(50, (100- PCTFREE))
F6: (100 - PCTFREE) * ( FLOOR[ (100 - min(10, pctfree)) / 100 *
(indexPageSize - 96) / (ISIZE + 12) ] ** (NLEVELS - 2) ) *
(indexPageSize - 96) / (KEYS * (ISIZE + 9) + (CARD
- KEYS) * 5) < 100
F7: 100 * (NUMRIDS DELETED / (NUMRIDS DELETED + CARD)) < 20
F8: 100 * (NUM EMPTY LEAFS / NLEAF) < 20
SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS
F4 F5 F6 F7 F8 REORG
-------------------------------------------------------------------------------------------------
Table: SIEBEL.CX_INT_LOGS
SIEBEL CX_INT_LOGS_M1 97836 527 0 3 10 0 74355
93 72 29 0 0 -----
SIEBEL CX_INT_LOGS_P1 97836 840 0 3 10 0 97836
75 55 24 0 0 *----
-------------------------------------------------------------------------------------------------
CLUSTERRATIO or normalized CLUSTERFACTOR (F4) will indicate REORG is
necessary
for indexes that are not in the same sequence as the base table. When
multiple
indexes are defined on a table, one or more indexes may be flagged as
needing
REORG. Specify the most important index for REORG sequencing.
Tables defined using the ORGANIZE BY clause and the corresponding
dimension
indexes have a '*' suffix to their names. The cardinality of a
dimension index
is equal to the Active blocks statistic of the table.
reorgchk current statistics on table SIEBEL.CX_INT_LOG_MON
Index statistics:
F4: CLUSTERRATIO or normalized CLUSTERFACTOR > 80
F5: 100 * (KEYS * (ISIZE + 9) + (CARD - KEYS) * 5) / ((NLEAF - NUM
EMPTY LEAFS -1) * (INDEXPAGESIZE - 96) > MIN(50, (100- PCTFREE))
F6: (100 - PCTFREE) * ( FLOOR[ (100 - min(10, pctfree)) / 100 *
(indexPageSize - 96) / (ISIZE + 12) ] ** (NLEVELS - 2) ) *
(indexPageSize - 96) / (KEYS * (ISIZE + 9) + (CARD
- KEYS) * 5) < 100
F7: 100 * (NUMRIDS DELETED / (NUMRIDS DELETED + CARD)) < 20
F8: 100 * (NUM EMPTY LEAFS / NLEAF) < 20
SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS
F4 F5 F6 F7 F8 REORG
-------------------------------------------------------------------------------------------------
Table: SIEBEL.CX_INT_LOG_MON
SIEBEL CX_INT_LOG_MON_P1 6 1 0 1 10 0 6
100 - - 0 0 -----
-------------------------------------------------------------------------------------------------
CLUSTERRATIO or normalized CLUSTERFACTOR (F4) will indicate REORG is
necessary
for indexes that are not in the same sequence as the base table. When
multiple
indexes are defined on a table, one or more indexes may be flagged as
needing
REORG. Specify the most important index for REORG sequencing.
Tables defined using the ORGANIZE BY clause and the corresponding
dimension
indexes have a '*' suffix to their names. The cardinality of a
dimension index
is equal to the Active blocks statistic of the table.
reorgchk current statistics on table SIEBEL.CX_INT_MON_VIOL
| |
|
|
chaituon...@gmail.com wrote:
> Hi John,
> Thank you for the help. I have an other doubt. What to do when i have
> something like the table below and i want to select some 10 lines after
> Index Statistics. I want to do this several times. Like i want to
> select multiple Index Statistics in the same file. Please help me with
> this. I mean i have an other Index Statistics below this file as shown
> below. Thanks in advance John
Seems like a possible job for sed (or awk)?
http://www.student.northpark.edu/pe...ed/sed1line.txt
>
> Index statistics:
>
> F4: CLUSTERRATIO or normalized CLUSTERFACTOR > 80
> F5: 100 * (KEYS * (ISIZE + 9) + (CARD - KEYS) * 5) / ((NLEAF - NUM
> EMPTY LEAFS -1) * (INDEXPAGESIZE - 96) > MIN(50, (100- PCTFREE))
> F6: (100 - PCTFREE) * ( FLOOR[ (100 - min(10, pctfree)) / 100 *
> (indexPageSize - 96) / (ISIZE + 12) ] ** (NLEVELS - 2) ) *
> (indexPageSize - 96) / (KEYS * (ISIZE + 9) + (CARD
> - KEYS) * 5) < 100
> F7: 100 * (NUMRIDS DELETED / (NUMRIDS DELETED + CARD)) < 20
> F8: 100 * (NUM EMPTY LEAFS / NLEAF) < 20
>
> SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS
> F4 F5 F6 F7 F8 REORG
> -------------------------------------------------------------------------------------------------
> Table: SIEBEL.CX_INT_LOGS
> SIEBEL CX_INT_LOGS_M1 97836 527 0 3 10 0 74355
> 93 72 29 0 0 -----
> SIEBEL CX_INT_LOGS_P1 97836 840 0 3 10 0 97836
> 75 55 24 0 0 *----
> -------------------------------------------------------------------------------------------------
>
> CLUSTERRATIO or normalized CLUSTERFACTOR (F4) will indicate REORG is
> necessary
> for indexes that are not in the same sequence as the base table. When
> multiple
> indexes are defined on a table, one or more indexes may be flagged as
> needing
> REORG. Specify the most important index for REORG sequencing.
>
> Tables defined using the ORGANIZE BY clause and the corresponding
> dimension
> indexes have a '*' suffix to their names. The cardinality of a
> dimension index
> is equal to the Active blocks statistic of the table.
>
>
> reorgchk current statistics on table SIEBEL.CX_INT_LOG_MON
>
>
>
>
>
>
> Index statistics:
>
> F4: CLUSTERRATIO or normalized CLUSTERFACTOR > 80
> F5: 100 * (KEYS * (ISIZE + 9) + (CARD - KEYS) * 5) / ((NLEAF - NUM
> EMPTY LEAFS -1) * (INDEXPAGESIZE - 96) > MIN(50, (100- PCTFREE))
> F6: (100 - PCTFREE) * ( FLOOR[ (100 - min(10, pctfree)) / 100 *
> (indexPageSize - 96) / (ISIZE + 12) ] ** (NLEVELS - 2) ) *
> (indexPageSize - 96) / (KEYS * (ISIZE + 9) + (CARD
> - KEYS) * 5) < 100
> F7: 100 * (NUMRIDS DELETED / (NUMRIDS DELETED + CARD)) < 20
> F8: 100 * (NUM EMPTY LEAFS / NLEAF) < 20
>
> SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS
> F4 F5 F6 F7 F8 REORG
> -------------------------------------------------------------------------------------------------
> Table: SIEBEL.CX_INT_LOG_MON
> SIEBEL CX_INT_LOG_MON_P1 6 1 0 1 10 0 6
> 100 - - 0 0 -----
> -------------------------------------------------------------------------------------------------
>
> CLUSTERRATIO or normalized CLUSTERFACTOR (F4) will indicate REORG is
> necessary
> for indexes that are not in the same sequence as the base table. When
> multiple
> indexes are defined on a table, one or more indexes may be flagged as
> needing
> REORG. Specify the most important index for REORG sequencing.
>
> Tables defined using the ORGANIZE BY clause and the corresponding
> dimension
> indexes have a '*' suffix to their names. The cardinality of a
> dimension index
> is equal to the Active blocks statistic of the table.
>
>
> reorgchk current statistics on table SIEBEL.CX_INT_MON_VIOL
| |
| Rick Caldwell 2006-11-17, 7:23 pm |
| chaituonweb@gmail.com wrote:
> Hi,
>=20
> Does anybody know how to use the grep command to print multiple lines?
> For example i have
>=20
>=20
> SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS=
>=20
> F4 F5 F6 F7 F8 REORG
> -----------------------------------------------------------------------=
----=AD----------------------
>=20
> Table: SIEBEL.CX_ASSET_X
> SIEBEL CX_ASSET_X_F1 146981 939 0 3 10 0 145153=
>=20
> 47 73 16 0 0 *----
> SIEBEL CX_ASSET_X_P1 146981 1086 0 3 10 0 146981=
>=20
> 99 64 16 0 0 -----
> SIEBEL CX_ASSET_X_U1 146981 1246 0 3 13 0 146981=
>=20
> 99 64 12 0 0 -----
> -----------------------------------------------------------------------=
----=AD----------------------
>=20
>=20
>=20
> i am trying to select Table:,SIEBLE and *---- using egrep but i am
> unable to do that. I am using cat filename|egrep
> 'Table:|SIEBEL|"*----"' but it doesnt work.
>=20
>=20
> I want to select Table and *----- at the same time so that i can run a
> reorg on the indexes which has a one *.=20
>=20
>=20
> THanks in advance
>=20
Not 100% I understand what you want but you might look at the -A option=20
in gnu grep - it lets you specify how many lines of text to print=20
following a match.
Rick
|
|
|
|
|