0

I have a file in below format

/data/uat/logs/server1/filename.log:2022-06-13 11:05:16,273|ERROR|demo|uat|componentA|pid1||random error text
/data/uat/logs/server1/filename.log:2022-06-13 11:06:16,273|ERROR|demo|uat|componentA|pid1||random error text
/data/uat/logs/server1/filename.log:2022-06-13 11:07:16,273|ERROR|demo|uat|componentA|pid2||random error text

/data/uat/logs/server1/filename.log:2022-06-13 11:05:16,273|ERROR|demo|uat|componentB|pid4||random error text
/data/uat/logs/server1/filename.log:2022-06-13 11:06:16,273|ERROR|demo|uat|componentB|pid4||random error text
/data/uat/logs/server1/filename.log:2022-06-13 11:07:16,273|ERROR|demo|uat|componentB|pid5||random error text

For a particular component i want to filter lines based on unique pid. So for above same lines expected output will be

/data/uat/logs/server1/filename.log:2022-06-13 11:05:16,273|ERROR|demo|uat|componentA|pid1||random error text
/data/uat/logs/server1/filename.log:2022-06-13 11:07:16,273|ERROR|demo|uat|componentA|pid2||random error text

/data/uat/logs/server1/filename.log:2022-06-13 11:05:16,273|ERROR|demo|uat|componentB|pid4||random error text
/data/uat/logs/server1/filename.log:2022-06-13 11:07:16,273|ERROR|demo|uat|componentB|pid5||random error text
jared_mamrot
  • 22,354
  • 4
  • 21
  • 46
Varun Chawla
  • 303
  • 1
  • 6
  • 19
  • Please add your efforts in form of code to avoid "Close votes" on your question, thank you. – RavinderSingh13 Jun 16 '23 at 05:29
  • 1
    Does this answer your question? [How to delete duplicate lines in a file without sorting it in Unix](https://stackoverflow.com/questions/1444406/how-to-delete-duplicate-lines-in-a-file-without-sorting-it-in-unix) I.e. `awk -F"|" '!seen[$6]++' file` – jared_mamrot Jun 16 '23 at 05:36

0 Answers0