FG
💻 Software

Most efficient way of taking a subset of lines

Fresh5 days ago
Mar 15, 2026952 views
Confidence Score0%
0%

Problem

I have two files. One huge one (200.000+ lines) called 'db' and one big one (15.000+ lines) called 'indices'. What is the quickest way of filtering out the lines in 'db' containing any index (anywhere on the line) from 'indices' The solution I could think of is but this is taking a long time. Is th…

Error Output

for index in $(cat indices); do
  grep $index db >> selection
done;

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Most efficient way of taking a subset of lines

Low Risk

should be faster.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment