Results 1 to 3 of 3

Thread: The AB of grep

  1. #1
    Join Date
    Jan 2009
    Zoetermeer, Holland

    Unanswered: The AB of grep

    Did not know that yet. Has been around for quite some time:

    on Linux you can specify the uppercase A and B parameters to grep. This stands for Before & After and lets you specify how many lines must be displayed extra besides the 'hit'. For us this could be extremly usefull when we're analysing db2diag files or big snapshots.

    Example: I want to see if and how frequent I get certain error messages
    cat db2diag.log | grep -i dia3603 -B6 -A1
    This will display all complete section containing this 'DIA3603E SSL bla bla bla' messages.

    I tried it on AIX as well but that grep-version is too old and does not support those fancy options
    On windows I tried it with the bash/grep which is included in the mobaXterm product and that works as well
    Somewhere between " too small" and " too large" lies the size that is just right.
    - Scott Hayes

  2. #2
    Join Date
    Nov 2011
    hi, dr_te_z
    I dont know the usage of parameters A and B of "grep",
    but if you want to display complete section in db2diag.log on aix.
    maybe you can try "-p" parameteres

  3. #3
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1
    I think you can also use db2diag for that, something like db2diag -g data:=DIA3603E
    "It does not work" is not a valid problem statement.

Posting Permissions

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