FG
💻 Software

xargs with multiple commands

Fresh7 days ago
Mar 15, 202612732 views
Confidence Score0%
0%

Problem

I'm trying to execute a sequence of commands on a list of files one by one. I was wondering if it is possible to use xargs something on the lines of Where is the command I want to execute on each file.

Error Output

ls *.txt | xargs -n 1 -I {} cat {} | grep foo > {}.foo

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: xargs with multiple commands

Low Risk

It might be possible to use something along the lines of or, to get rid of the useless It's usually easier to put it in a shell script so you can just pass it files. Pedantry: won't do the right thing with special characters, notably embedded newlin…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment