Hi Guys,
I am having a file in below format:
job1|start|01/01/1988 10:10:10
job2|start|01/01/1988 10:10:10
job1|start|01/01/1988 11:10:10
job1|end|01/01/1988 12:10:10
job2|end|01/01/1988 12:10:10
job3|start|01/01/1988 14:10:10
job4|end|01/01/1988 15:10:10
I need the output like this:
job1|start|01/01/1988 11:10:10|end|01/01/1988 12:10:10
job2|start|01/01/1988 10:10:10|end|01/01/1988 12:10:10
job3|start|01/01/1988 14:10:10
job4|end|01/01/1988 15:10:10
If the job has start it should consider the latest start time my file will have the latest end time only.
If the job is having only start time or end tim , then display start time in the format above like how job3 and job4 is having
I have tried something like this but couldn't able to achieve :
awk '{i=$1; $1=x; A=A $0} $2=="end"{print i A}' FS=\| OFS=\| file