Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    Madrid - Spain
    Posts
    422
    Provided Answers: 1

    Unanswered: sort output by columns.

    Good morning,
    I need to order the output of a command for a columns that is a date, as I can do this?

    Example:
    0002 1 0 2457764 UOW Waiting 08/19/2012 03:02:04.731545
    0002 1 0 7110788 UOW Waiting 08/19/2012 03:02:02.166406
    6004 1 0 7512128 UOW Waiting 08/24/2012 05:02:04.203400
    0023 1 0 7659730 UOW Waiting 08/19/2012 03:02:56.656771
    0017 1 0 6176842 UOW Waiting 08/24/2012 05:25:25.300643
    0022 1 0 5312688 UOW Waiting 08/12/2012 14:07:03.500634
    0022 1 0 5673166 UOW Waiting 08/12/2012 14:07:03.488451
    0002 1 0 876650 UOW Waiting 08/12/2012 14:07:01.415360
    0002 1 0 9773148 UOW Waiting 08/12/2012 14:07:01.414868
    0022 1 0 1261572 UOW Waiting 08/12/2012 14:07:03.440434
    0022 1 0 2019348 UOW Waiting 08/12/2012 14:07:03.412111
    0022 1 0 12361812 UOW Waiting 08/12/2012 14:07:01.408612

    In this case i need sort this output by columns 08/19/2012 03:02:04.731545.

    Thank you very much and greetings.
    DBA DB2 for LUW

  2. #2
    Join Date
    Jan 2010
    Posts
    335
    > cat test.data
    0002 1 0 2457764 UOW Waiting 07/19/2012 03:02:04.731545
    0002 1 0 7110788 UOW Waiting 08/19/2011 03:02:02.166406
    6004 1 0 7512128 UOW Waiting 08/24/2012 05:02:04.203400
    0023 1 0 7659730 UOW Waiting 08/19/2012 03:02:56.656771
    0017 1 0 6176842 UOW Waiting 08/24/2012 05:25:25.300643
    0022 1 0 5312688 UOW Waiting 09/12/2012 14:07:03.500634
    0022 1 0 5673166 UOW Waiting 08/12/2009 14:07:03.488451
    0002 1 0 876650 UOW Waiting 08/12/1912 14:07:01.415360
    0002 1 0 9773148 UOW Waiting 04/12/2012 14:07:01.414868
    0022 1 0 1261572 UOW Waiting 10/12/2012 14:07:03.440434
    0022 1 0 2019348 UOW Waiting 08/12/2010 14:07:03.412111
    0022 1 0 12361812 UOW Waiting 08/04/2012 14:07:01.408612

    > cat test.data | sort -n -k 7.8 -k 7.1 -k 7.5 -k8
    0002 1 0 876650 UOW Waiting 08/12/1912 14:07:01.415360
    0022 1 0 5673166 UOW Waiting 08/12/2009 14:07:03.488451
    0022 1 0 2019348 UOW Waiting 08/12/2010 14:07:03.412111
    0002 1 0 7110788 UOW Waiting 08/19/2011 03:02:02.166406
    0002 1 0 9773148 UOW Waiting 04/12/2012 14:07:01.414868
    0002 1 0 2457764 UOW Waiting 07/19/2012 03:02:04.731545
    0022 1 0 12361812 UOW Waiting 08/04/2012 14:07:01.408612
    0023 1 0 7659730 UOW Waiting 08/19/2012 03:02:56.656771
    0017 1 0 6176842 UOW Waiting 08/24/2012 05:25:25.300643
    6004 1 0 7512128 UOW Waiting 08/24/2012 05:02:04.203400
    0022 1 0 5312688 UOW Waiting 09/12/2012 14:07:03.500634
    0022 1 0 1261572 UOW Waiting 10/12/2012 14:07:03.440434


    Don't ask me why it's 7.8 and 7.5 ...

Posting Permissions

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