You are not logged in.

#1 2005-10-20 21:40:05

peabrain
Member
Registered: 2005-08-08
Posts: 42

From pipe to a specific argument?

We'll I just cant find the answer to this one... or if I've just missed it, I'm going to get myself a new pair of eyes. So I apologize, if this is an unnecessary post.

The problem: how do I use pipes to use the output from the pipe as a specific argument of the next program?

Say I want to use the output from the pipe as the first argument, and after that there's going to be other arguments.
An example:
DoThis ThisFile | DoThat (the output from the pipe) --with ThatFile

So that it just won't be send to the end of the argument line.

Offline

#2 2005-10-20 21:55:56

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: From pipe to a specific argument?

you want "xargs"
http://www.mkssoftware.com/docs/man1/xargs.1.asp

the following is the same as "cp * *.bak"

ls | xargs -I '{}' cp '{}' '{}'.bak

Offline

Board footer

Powered by FluxBB