Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2007
    Posts
    14

    Unanswered: Sorting on a Line Item

    I Have a file that contain the following paragraphs. How to sort these paragraphs on "Rows Read" or "Rows Written" or "Overflows"

    Table Schema = SYSIBM
    Table Name = SYSTABLES
    Table Type = Catalog
    Data Object Pages = 55
    Index Object Pages = 27
    LOB Object pages = 1728
    Rows Read = 2121
    Rows Written = 1
    Overflows = 5
    Page Reorgs = 0

    Table Schema = SYSIBM
    Table Name = SYSCOLUMNS
    Table Type = Catalog
    Data Object Pages = 459
    Index Object Pages = 241
    Rows Read = 1039
    Rows Written = 4
    Overflows = 45
    Page Reorgs = 1

    Table Schema = SYSIBM
    Table Name = SYSCOLUMNS
    Table Type = Catalog
    Data Object Pages = 55
    Index Object Pages = 27
    LOB Object pages = 1728
    Rows Read = 2121
    Rows Written = 1
    Overflows = 5
    Page Reorgs = 0

    Table Schema = SYSIBM
    Table Name = SYSPROCS
    Table Type = Catalog
    Data Object Pages = 459
    Index Object Pages = 241
    Rows Read = 1039
    Rows Written = 4
    Overflows = 45
    Page Reorgs = 1


    Thx ahead for the help
    Tony

  2. #2
    Join Date
    Jan 2004
    Location
    Bordeaux, France
    Posts
    320
    Try and adapt the following script :

    Code:
    awk -v Field='Overflows' '
       BEGIN {
          RS  = "";
          FS  = "\n" 
          Field = toupper(Field) 
          Field_pattern = ".*" Field " = ";
       }
       { 
          Value = toupper($0);
          sub(Field_pattern, "", Value);
          sub(/\n.*/, "", Value);
    
          for (i=1; i<=NF+1; i++) {
             print Value,NR,i,$i
          }
       }
    ' input_file |
    sort -k1,3n |
    cut -f4-
    Jean-Pierre.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •