Jan. 9th, 2007

sbc_compliant: (Default)
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:

# 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 -u

So, then I went and scanned the man cut page. Pretty sweet little trick.

Profile

sbc_compliant: (Default)
sbc_compliant

November 2019

S M T W T F S
     12
3456789
10111213141516
17181920212223
24252627282930

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 10th, 2026 09:55 am
Powered by Dreamwidth Studios