I have to compute the mean values between numbers with the same identifier (the Id in the 4th column) and associate the corresponding value to specific regions and avoid to write again the same Identifier. Here the example:  Input:chr     start   end     Id       Enrichmentchr1    778001  778400  SN_1946  19.52706chr1    778001  778400  SN_1946  521.39759chr1    778401  778800  SN_1947  19.52706chr1    778401  778800  SN_1947  521.39759chr1    826801  827200  SN_2068  162.07837chr1    827201  827600  SN_2069  162.07837Outputchr     start   end     Id       Enrichmentchr1    778001  778400  SN_1946  270.45chr1    778401  778800  SN_1947  270.45chr1    826801  827200  SN_2068  162.07837chr1    827201  827600  SN_2069  162.07837I have tried inspiration from previous posts but I have not found a possible solution or idea.
Compute Mean Values associate with the same identifier
text processing;awk;bioinformatics