So, today I had to look for $error_du_jour in a particular log file, in order to do some stuff the the items throwing the errors.
To find the items, I did this:
When I was done, and told my boss, he asked if I'd done it this way:
So, then I went and scanned the
To find the items, I did this:
# grep 'ERROR_DU_JOUR' log > raw_results.txt
# head raw_results.txt
[see raw results here, and find that the item in question is on field 20]
# awk '{print $20}' raw_results.txt > items.txt
# head items.txt
[see raw items here, with a trailing comma]
# sed 's/\,$//g' items.txt | sort -u > clean.txt
# cat clean.txt
[see only list of affected items here]
# When I was done, and told my boss, he asked if I'd done it this way:
# grep 'ERROR_DU_JOUR' log | awk '{print $20}' | cut -d, -f1 | sort -uSo, then I went and scanned the
man cut page. Pretty sweet little trick.