xargs v0.01 (13 May 1998)
=========================

SYNTAX

    xargs [-n number] [-t] <command> [arguments]

DESCRIPTION

    xargs is based on the Unix utility of the same name and was written
    (fairly hastily) to complement each.  It will read arguments from the
    standard input and call the command with them.  While this might not
    sound particularly useful at first, imagine that you want to delete all
    the files that each matches.  You might try the following:
        each <Wimp$ScrapDir> -type f -time +3 -exec remove %0 ;
    However, chances are you'll find that this doesn't work, or that it only
    deletes a few of the files that it should have.  The problem is that
    you're altering the contents of the directory while each is still looking
    in it, and so things are getting confused.  The solution is to let each
    produce a list of all the matching files and then delete all these files
    afterwards:
        each <Wimp$ScrapDir> -type f -time +3 -print > pipe:$.filelist
    Unfortunately, remove (like most RISC OS commands) can't read arguments
    from the standard input, and this is where xargs comes in:
        xargs remove < pipe:$.filelist
    If you want to see what commands xargs is executing, using the -t flag:
        xargs -t remove < pipe:$.filelist

    By default xargs will read one argument at a time before calling the
    command, since this is what most RISC OS filing commands expect, but you
    can change this using "-n <number>".  Imagine you want to search a
    directory for text files containing the word "foo".  You could do the
    following:
        each . -type text -exec grep -throwback foo %0 ;
    This isn't very efficient though, since grep is being run once for every
    single text file found.  You can rewrite the above command as follows:
        each . -type text -print > pipe:$.filelist
        xargs -n 10 grep -throwback < pipe:$.filelist
    Now grep will be called with ten (or less, if there isn't enough input)
    filenames at a time, which is potentially much quicker.

CONTACT

    Bug reports, fixes, comments, etc.. to paul@plasma.demon.co.uk

COPYRIGHT

    This program can be freely distributed, so long as the author's name is
    not removed from any of the files.  The program comes with no guarantee,
    implied or stated, and no responsibility can be accepted by the author
    for any kind of loss.
