FG
💻 Software

Tail multiple files while piping one of the files through grep

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

Problem

I want to use tail follow two log files, but one of the log files has too much data, so I want it filtered with grep. The issue with this is that both files are run through the grep or rather the output of tail is run through grep. Only file2 should be filtered with the grep of mySearch. Any ideas?…

Error Output

tail -f file1 file2|grep mySearch

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Tail multiple files while piping one of the files through grep

Low Risk

can you run the two tails in the background, piping the filtered and unfiltered output to a temp file. Then use that temp file as the source for whatever you need to dos -

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment