This is the mail archive of the
cygwin-xfree
mailing list for the Cygwin XFree86 project.
Re: Xargs....
- From: "Mark J. Reed" <markjreed at mail dot com>
- To: cygwin-xfree at cygwin dot com
- Date: Mon, 22 Oct 2007 12:36:45 -0400
- Subject: Re: Xargs....
- References: <726430.13928.qm@web57502.mail.re1.yahoo.com>
- Reply-to: cygwin-xfree at cygwin dot com
On 10/22/07, Hall Nation <halluc1nati0n@yahoo.com> wrote:
> I just couldn't get what was described abt xargs in man ,,, I mean I need it in simple terms.. (layman terms)
xargs has nothing to do with X11, first of all. The "x" in this case
means "trans", as in "transpose", which is the operation that takes a
vertical column and turns it into a horizontal row.
Say you have a file named x.txt with these lines in it:
x1
x2
x3
Now say you run this:
xargs echo <x.txt
The xargs command will build a new command for you and run it on your
behalf, by reading each line of its input (file x.txt) and turning it
into an argument. So it will run
echo x1 x2 x3
and you will get
x1 x2 x3
output to your terminal.
find . | xargs grep
is how you do a grep of a bunch of files when they might be in
subdirectories. "find ." will output their names, one to a line, and
xargs turns them into arguments to the grep command.
--
Mark J. Reed <markjreed@mail.com>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/