Extract and sort unique instances of a pattern (ERROR:\w*) from a file:
Or to save to a file:
For ripgrep (rg), add -N to -o to prevent line numbers in output:
Breakdown
grep -o 'ERROR:\w*' logfileorrg -o -N 'ERROR:\w*' logfile: ExtractsERROR:followed by any number of word characters ([a-zA-Z0-9_]).sort -u: Sorts and removes duplicates.lessor> sorted_errors.txt: Displays results or saves to file.
Replace logfile with your file and adjust the pattern as needed.