Sponsored Content
Top Forums Shell Programming and Scripting sed print between 2 patterns only last occurence Post 302725927 by durden_tyler on Saturday 3rd of November 2012 12:50:41 AM
Old 11-03-2012
Code:
$
$
$ cat -n f16
     1  index sql
     2
     3  *** Index has been created.
     4  *** Total elapsed time was 8 seconds.
     5
     6
     7  +---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+-
     8
     9  index from 1
    10
    11  *** Index has been created.
    12  *** Total elapsed time was 2 seconds.
    13
    14
    15  +---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+-
    16  table from 2
    17
    18  *** Index has been created.
    19  *** Total elapsed time was 2 seconds.
    20
    21
    22  +---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+-
    23  sql create from 1
    24
    25  *** Query completed. One row found. 3 columns returned.
    26  *** Total elapsed time was 1 second.
    27
    28  abc def ghi
    29  --------- ---------- ----------
    30  123 456 789
    31
    32  +---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+-
    33
    34  .IF ACTIVITYCOUNT > 0 THEN .QUIT 600;
    35  .QUIT 600;
    36  *** You are now logged off from the DBC.
    37  *** Exiting BTEQ...
    38  *** RC (return code) = 600
    39  returncode is 600
$
$
$ perl -0ne 'while(/Total elapsed.*?\.\n(.*?-\+-)\n/sg){$x=$1} END{print $x,"\n"}' f16

abc def ghi
--------- ---------- ----------
123 456 789

+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+-
$
$
$

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed/awk print between different patterns the first occurrence

Thanks for the help yesterday. I have a little modification today, I am trying the following: i have a log file of a webbap which logs in the following pattern: 2011-08-14 21:10:04,535 blablabla ERROR Exception1 blablabla bla bla bla bla 2011-08-14... (2 Replies)
Discussion started by: ppolianidis
2 Replies

2. Shell Programming and Scripting

[Solved] Sed/awk print between patterns the first occurrence

Guys, I am trying the following: i have a log file of a webbap which logs in the following pattern: 2011-08-14 21:10:04,535 blablabla ERROR blablabla bla bla bla bla 2011-08-14 21:10:04,535 blablabla ERROR blablabla bla bla bla ... (6 Replies)
Discussion started by: ppolianidis
6 Replies

3. Shell Programming and Scripting

How to get line after occurence of sequence of patterns

In the past I needed a help with the problem how to search for pattern after the occurence of another pattern which is described in this thread: https://www.unix.com/shell-programmin...-pattern1.html Now I would need something quite similar, only the pattern which is to be searched must be... (3 Replies)
Discussion started by: sameucho
3 Replies

4. Shell Programming and Scripting

Retrieve lines that match any occurence in a list of patterns

I have two files. The first containing a header and six columns of data. Example file 1: Number SNP ID dbSNP RS ID Chromosome Result_Call Physical Position 787066 SNP_A-8575395 RS6650104 1 NOCALL 564477 786872 SNP_A-8575125 RS10458597 1 AA ... (13 Replies)
Discussion started by: Selftaught
13 Replies

5. UNIX for Dummies Questions & Answers

How to print first occurence

Hi there, how can i print the first pattern occurrence in a .log file? I want to print the filename of the first 17262? I tried but all I can do is print all the lines with the number 17262? I tried using awk and sed but nothing!:wall: I just want filename! Here´s an example: 17259... (3 Replies)
Discussion started by: BMatter
3 Replies

6. Shell Programming and Scripting

Print mutliple patterns in a line using sed

Hi, I am trying to print multiple patterns in a line using sed. But it is printing only the last occurance of a pattern. If the line is the the output should be Lookup Procedure|Stored proc But the output I am getting is Stored proc The code I am using is echo... (9 Replies)
Discussion started by: kedar_laveti
9 Replies

7. Shell Programming and Scripting

Print between patterns - first occurence, second occurence etc

I have a file # cat asasas AAAAAA 11 22 33 44 BBBBB NILNILNIL AAAAAA 22 33 44 55 66 77 88 BBBBB NILNILNIL (2 Replies)
Discussion started by: anil510
2 Replies

8. Shell Programming and Scripting

Grab nth occurence in between two patterns using awk or sed

Hi , I have an issue where I want to parse through the output from a file and I want to grab the nth occurrence of text in between two patterns preferably using awk or sed ! TICKET NBR : 1 !GSI : 102 ! 3100.2.112.1 11/06/2013 15:56:29 ! 3100.2.22.3 98 ! 3100.2.134.2... (8 Replies)
Discussion started by: OTNA
8 Replies

9. UNIX for Advanced & Expert Users

Get the first occurence between two patterns

I have an output file which gives me the timely status of a server. Sample file: March 11 2014 21:10, 1, 2, 3, 4, 5, 6, 7, 8, 9, x, y, z... 21:05, 1, 2, 3, 4, 5, 6, 7, 8, 9, x, y, z... 21:00, 1, 2, 3, 4,... (3 Replies)
Discussion started by: rpm120
3 Replies

10. Shell Programming and Scripting

Find matched patterns and print them with other patterns not the whole line

Hi, I am trying to extract some patterns from a line. The input file is space delimited and i could not use column to get value after "IN" or "OUT" patterns as there could be multiple white spaces before the next digits that i need to print in the output file . I need to print 3 patterns in a... (3 Replies)
Discussion started by: redse171
3 Replies
DBSchema::Index(3pm)					User Contributed Perl Documentation				      DBSchema::Index(3pm)

NAME
DBIx::DBSchema::Index - Index objects SYNOPSYS
use DBIx::DBSchema::Index; $index = new DBIx::DBSchema::Index ( { } ); DESCRIPTION
DBIx::DBSchema::Index objects represent a unique or non-unique database index. METHODS
new HASHREF | OPTION, VALUE, ... Creates a new DBIx::DBschema::Index object. Accepts either a hashref or a list of options and values. Options are: name - Index name using - Optional index method unique - Boolean indicating whether or not this is a unique index. columns - List reference of column names (or expressions) name [ INDEX_NAME ] Returns or sets the index name. using [ INDEX_METHOD ] Returns or sets the optional index method. unique [ BOOL ] Returns or sets the unique flag. columns [ LISTREF ] Returns or sets the indexed columns (or expressions). columns_sql Returns a comma-joined list of columns, suitable for an SQL statement. sql_create_index TABLENAME Returns an SQL statment to create this index on the specified table. cmp OTHER_INDEX_OBJECT Compares this object to another supplied object. Returns true if they are identical, or false otherwise. cmp_noname OTHER_INDEX_OBJECT Compares this object to another supplied object. Returns true if they are identical, disregarding index name, or false otherwise. AUTHOR
Ivan Kohler <ivan-dbix-dbschema@420.am> Copyright (c) 2007 Ivan Kohler Copyright (c) 2007 Freeside Internet Services, Inc. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. BUGS
Is there any situation in which sql_create_index needs to return a list of multiple statements? SEE ALSO
DBIx::DBSchema::Table, DBIx::DBSchema, DBI perl v5.14.2 2007-06-28 DBSchema::Index(3pm)
All times are GMT -4. The time now is 06:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy