Xargs....

Mark J. Reed markjreed@mail.com
Mon Oct 22 16:36:00 GMT 2007


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/



More information about the Cygwin-xfree mailing list