This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Xargs....


Thanks for the clarification mate ...
Now I know ... 

----- Original Message ----
From: Mark J. Reed <markjreed@mail.com>
To: cygwin-xfree@cygwin.com
Sent: Monday, October 22, 2007 10:06:45 PM
Subject: Re: Xargs....


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/





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]