Linux Survival Basics
Count Failures by Test File
A CI log has repeated failures and you need to see which files appear most often.
Command
grep -RhoE '[A-Za-z0-9_./-]+\.(test|spec)\.(js|ts|py|rb)' logs/ | sort | uniq -c | sort -nr | head
What changed
Nothing changes. The command extracts and counts file path mentions.
Danger
safe
When to use it
Use when a test suite produces many repeated failure lines.
When not to use it
Do not use it when your CI emits structured JSON test reports that should be queried directly.
Undo or recovery
No undo needed because this command is read-only.
Expected output
A ranked list of test file paths with occurrence counts.
demo script
Disposable terminal steps
cat logs/test.loggrep -RhoE '[A-Za-z0-9_./-]+\.(test|spec)\.(js|ts|py|rb)' logs/ | sort | uniq -c | sort -nr | head
simulated output
What it looks like
::fixture-ready::
$ cat logs/test.log
fail tests/checkout.spec.ts
fail tests/login.spec.ts
fail tests/checkout.spec.ts
::exit-code::0
$ grep -RhoE '[A-Za-z0-9_./-]+\.(test|spec)\.(js|ts|py|rb)' logs/ | sort | uniq -c | sort -nr | head
2 tests/checkout.spec.ts
1 tests/login.spec.ts
1 checkout.spec.ts
::exit-code::0
YouTube Short
Rank failing tests.
Extract test filenames from the log, count them, and sort. Now the noisy failure has a shape.
LinkedIn hook
Turn noisy test logs into a ranked failure list.
Question: When many tests fail, do you rank the failures or inspect them in log order?
experiments
A/B tests to run
Metric: retention_rate
A: Rank failing tests.
B: Give noisy CI a shape.