Hi All,
I am storing the result in the variable result_text using the below code.
result_text=$(printf "$result_text\t\n$name")
The result_text is having the below text. Which is having duplicate lines.
file and time for the interval 03:30 - 03:45
file and time for the interval 03:30 - 03:45
file and time for the interval 03:45 - 03:59
file and time for the interval 04:00 - 04:15
file and time for the interval 04:00 - 04:15
file and time for the interval 04:15 - 04:30
file and time for the interval 04:15 - 04:30
I have tried the below code to remove duplicates but not working.
Works for me, given you correct the variable assignment to include the last trailing space, and the text remains sorted as it is right now:
printf "$result_text" | uniq
file and time for the interval 03:30 - 03:45
file and time for the interval 03:45 - 03:59
file and time for the interval 04:00 - 04:15
file and time for the interval 04:15 - 04:30
You could hit THANKS button for saying thanks to anyone here.
Try following and let me know if this helps you. I am getting proper output from this command.