Hi,
I have the following output from an Oracle SQL statement and I want to remove duplicated column values.
I know it is possible using Oracle analytical/statistical functions but unfortunately I don't know how to use any of those.
So now, I've gone to PLAN B using awk/sed maybe or any other UNIX string tips/tricks.
The original output is as below:
CHANGE REQUESTOR START END STATUS SERVICE_NO GROUP RESOURCE_PERSON
----------- -------------------- ------------------- ------------------- --------------- ----------- ------------------------- --------------------
153281 User AAA 2016-07-21 23:00:00 2016-07-22 01:00:00 Closed 466814 Support Number 1 Mars
153282 User ABCDE 2016-07-28 10:00:00 2016-07-28 11:00:00 Closed 466875 Linux Martian 01
153282 User ABCDE 2016-07-28 10:00:00 2016-07-28 11:00:00 Closed 466876 DBA Earthling 01
153283 User BBB 2016-07-28 12:00:00 2016-07-28 15:00:00 Closed 467055 Storage Jupiter
153286 User WXYZ 2016-07-28 18:00:00 2016-08-02 20:00:00 Closed 466877 DBA Earthling 02
153286 User WXYZ 2016-07-28 18:00:00 2016-08-02 20:00:00 Closed 467105 Unix Martian 02
153287 User ABCDEF 2016-08-01 10:00:00 2016-08-01 11:00:00 Closed 466923 Linux Martian 01
153287 User ABCDEF 2016-08-01 10:00:00 2016-08-01 11:00:00 Closed 466924 DBA Earthling 01
153288 User XXX123456 2016-08-12 10:00:00 2016-08-12 11:00:00 Closed 466812 Linux Martian 01
153288 User XXX123456 2016-08-12 10:00:00 2016-08-12 11:00:00 Closed 466813 DBA Earthling 01
153290 User XXXYYYZZZ 2016-08-15 18:30:00 2016-08-15 19:30:00 Closed 467098 Linux Martian 01
153290 User XXXYYYZZZ 2016-08-15 18:30:00 2016-08-15 19:30:00 Closed 467099 DBA Earthling 01
Below is the desired output. There are instances where the first five columns are repeated values and where they are repeated values, I want to display those five column values on its first occurrence only.
Desired output below:
CHANGE REQUESTOR START END STATUS SERVICE_NO GROUP RESOURCE_PERSON
----------- -------------------- ------------------- ------------------- --------------- ----------- ------------------------- --------------------
153281 User AAA 2016-07-21 23:00:00 2016-07-22 01:00:00 Closed 466814 Support Number 1 Mars
153282 User ABCDE 2016-07-28 10:00:00 2016-07-28 11:00:00 Closed 466875 Linux Martian 01
466876 DBA Earthling 01
153283 User BBB 2016-07-28 12:00:00 2016-07-28 15:00:00 Closed 467055 Storage Jupiter
153286 User WXYZ 2016-07-28 18:00:00 2016-08-02 20:00:00 Closed 466877 DBA Earthling 02
467105 Unix Martian 02
153287 User ABCDEF 2016-08-01 10:00:00 2016-08-01 11:00:00 Closed 466923 Linux Martian 01
466924 DBA Earthling 01
153288 User XXX123456 2016-08-12 10:00:00 2016-08-12 11:00:00 Closed 466812 Linux Martian 01
466813 DBA Earthling 01
153290 User XXXYYYZZZ 2016-08-15 18:30:00 2016-08-15 19:30:00 Closed 467098 Linux Martian 01
467099 DBA Earthling 01
A final thing that I am wanting to do if possible is to have the desired output to be a delimited file, i.e. pipe or comma delimited that I can open from a spreadsheet program. In this case, the repeated column values would have to be replaced by the delimiter character instead.
Any advice much appreciated. Thanks in advance.