I have a text file of this type, and I would look for any lines containing the string Validating Classification
and then obtain uniquely the reported errors. I do not know the types of possible errors.
Input file:
201600415 10:40 Error Validating Classification: error1
201600415 10:41 Error Validating Classification: error1
201600415 10:42 Error Validating Classification: error2
201600415 10:43 Error Validating Classification: error3
201600415 10:44 Error Validating Classification: error3
Output file
201600415 10:40 Error Validating Classification: error1
201600415 10:42 Error Validating Classification: error2
201600415 10:43 Error Validating Classification: error3
Can I achieve this using grep, pipes and other commands?
grep .... | sort --unique
– Ahmed Nabil Aug 03 '22 at 07:53git grep -h <pattern> | sort --unique
will give unique occurrences of grep matches. – Paul Rougieux Nov 29 '22 at 15:58