Extract all unique email addresses from a file.
BeginnerHands-onawk, sed, grep and jq one-liners
Answer
grep -Eoi '[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}' file.txt | sort -fu
Key trick → -o prints only the matched part, not the whole line. sort -fu de-duplicates without caring about case.
More on awk, sed, grep and jq one-liners
Print only the lines containing "ERROR" with 3 lines of context, and show line numbers.BeginnerSum the response sizes (field 10) in an Nginx access log and print the total in MB.BeginnerReplace `DEBUG` with `INFO` in a config file in place, keeping a backup.BeginnerFrom `kubectl get pods -A -o json`, list pods that are not Running, as namespace/name/phase.IntermediatePrint the 3rd column of a CSV whose fields are separated by commas, skipping the header.BeginnerDelete all blank lines and comment lines from a config file and show what's actually active.Beginner