Prev: ResultSet and String array
Next: testsieger versicherungen, versicherungsvergleich berufsunfähigkeit, berufsunfähigkeitsversicherung preisvergleich, berufsunfähigkeitszusatzversicherung, berufsunfähig versicherung, berufsunfähigkeitsversicherungen im vergleich,
From: Peter Duniho on 24 Feb 2010 19:43 Tom Anderson wrote: > On Wed, 24 Feb 2010, John B. Matthews wrote: > >> Such a reference is not without precedent: >> >> $ find javadoc/jdk6 -name \*html \ >> | xargs -J % grep "Java Language Specification" % \ >> | wc -l >> 159 > > Which xargs has a -J? Solaris or something? From John's message header: User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) And from the Mac OS X xargs man page: -J replstr If this option is specified, xargs will use the data read from standard input to replace the first occurrence of replstr instead of appending that data after all other arguments. This option will not affect how many arguments will be read from input (-n), or the size of the command(s) xargs will generate (-s). The option just moves where those arguments will be placed in the command(s) that are executed. The replstr must show up as a dis- tinct argument to xargs. It will not be recognized if, for instance, it is in the middle of a quoted string. Furthermore, only the first occurrence of the replstr will be replaced. For example, the following command will copy the list of files and directories which start with an uppercase letter in the current directory to destdir: /bin/ls -1d [A-Z]* | xargs -J % cp -rp % destdir Hope that wasn't more info than you were hoping for. Of course, I never did really answer the precise question you asked. There may be other platforms with an xargs that has the -J option. But it seems likely that John's use comes from the same OS he's using to post his message, Mac OS X. :) Pete
From: Tom Anderson on 25 Feb 2010 11:42 On Wed, 24 Feb 2010, Peter Duniho wrote: > Tom Anderson wrote: >> On Wed, 24 Feb 2010, John B. Matthews wrote: >> >>> Such a reference is not without precedent: >>> >>> $ find javadoc/jdk6 -name \*html \ >>> | xargs -J % grep "Java Language Specification" % \ >>> | wc -l >>> 159 >> >> Which xargs has a -J? Solaris or something? > > From John's message header: > > User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) > > And from the Mac OS X xargs man page: > > -J replstr > If this option is specified, xargs will use the data read from > standard input to replace the first occurrence of replstr instead > of appending that data after all other arguments. This option > will not affect how many arguments will be read from input (-n), > or the size of the command(s) xargs will generate (-s). The > option just moves where those arguments will be placed in the > command(s) that are executed. The replstr must show up as a dis- > tinct argument to xargs. It will not be recognized if, for > instance, it is in the middle of a quoted string. Furthermore, > only the first occurrence of the replstr will be replaced. For > example, the following command will copy the list of files and > directories which start with an uppercase letter in the current > directory to destdir: > > /bin/ls -1d [A-Z]* | xargs -J % cp -rp % destdir Huh. As a five-year OS X user, not knowing this is quite embarrassing. It's a nice feature. Thanks for the very sensible find. I noticed that on linux (and possibly on other unices - not sure if it's a GNUism or not) several commands (like mv and cp) that are usually of the form COMMAND INPUT1 INPUT2 ... INPUTN OUTPUT have variant like COMMAND -t OUTPUT INPUT1 INPUT2 ... INPUTN. I can only assume this is to make them more xargs-friendly. -J is a better alternative! > Hope that wasn't more info than you were hoping for. Never. > Of course, I never did really answer the precise question you asked. > There may be other platforms with an xargs that has the -J option. I suspect BSD. Yup: http://www.freebsd.org/cgi/man.cgi?query=xargs&apropos=0&sektion=0&manpath=FreeBSD+8.0-RELEASE&format=html > But it seems likely that John's use comes from the same OS he's using to > post his message, Mac OS X. :) Indeed, a conclusion of almost Holmesian perspicacity. tom -- 24-Hour Monkey-Vision!
From: John B. Matthews on 25 Feb 2010 15:03
In article <alpine.DEB.1.10.1002251621100.26227(a)urchin.earth.li>, Tom Anderson <twic(a)urchin.earth.li> wrote: > I suspect BSD. $ man xargs | head -1 | awk '{ print $1" "$2 }' XARGS(1) BSD Alpine on Mac OS X? <http://www.madboa.com/geek/pine-macosx/> Also on MacPorts: <http://trac.macports.org/browser/trunk/dports/mail/alpine/Portfile> -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews> |