1 |
Am Fri, 10 Mar 2017 14:05:02 +1100 |
2 |
schrieb Adam Carter <adamcarter3@×××××.com>: |
3 |
|
4 |
> I have one command that dumps out a number of lines of output, and i |
5 |
> want to have another command run multiple times taking a single line |
6 |
> contents as its argument(s) each time. From what i understand of |
7 |
> xargs it takes all the piped input and runs a command once with each |
8 |
> of the piped inputs as another argument. |
9 |
> |
10 |
> Eg. say i want to run ethtool against each active interface dumped |
11 |
> out by; ifconfig | grep ^[a-zA-Z] | awk '{print $1}' |
12 |
|
13 |
I prefer piping such "one file name per line" outputs to the following |
14 |
construct: |
15 |
|
16 |
... | while read line; do command "$line"; done |
17 |
|
18 |
-- |
19 |
Regards, |
20 |
Kai |
21 |
|
22 |
Replies to list-only preferred. |