1 |
On Fri, 10 Mar 2017, Adam Carter wrote: |
2 |
|
3 |
> I have one command that dumps out a number of lines of output, and i |
4 |
> want to have another command run multiple times taking a single line |
5 |
> contents as its argument(s) each time. From what i understand of xargs |
6 |
> it takes all the piped input and runs a command once with each of the |
7 |
> piped inputs as another argument. |
8 |
> Eg. say i want to run ethtool against each active interface dumped out |
9 |
> by; |
10 |
> ifconfig | grep ^[a-zA-Z] | awk '{print $1}' |
11 |
> Tnx |
12 |
|
13 |
pipe to `while read` ? |
14 |
|
15 |
yourcommand | while read line; do |
16 |
echo $line |
17 |
done |
18 |
|
19 |
-- |
20 |
~ parazyd |
21 |
GPG: 0333 7671 FDE7 5BB6 A85E C91F B876 CB44 FA1B 0274 |