[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Off Topic: streaming a text file into a command?



On Wed, Oct 11, 2000 at 04:47:28PM -0500, William Jensen wrote:
> Hey guys,
> 
> I'm trying to find the fastest mirror site.  I am using a package called
> netselect.  Works like this netselect -vv host1 host2 ... hostx.  Wonderful
> little utility.  Anyway, I have a list of mirrors in a text file like this:
> 
> host1
> host2
> host3
> 
> How can I pump that file into netselect?  I tried netselect -vv < file but
> it just laughed at me. :)

probably rolling its eyes as it did so...

short version:

	if your text file has one word per line, try this:

		netselect -vv `cat my-settings-file`

long version:

	if you 'store' the output of a command in a variable,
	you get all the tabs, spaces and newlines verbatim.
	when you use that as an argument to a command,
	*nix scrunches all whitespace into single space
	characters, so all the command will 'see' is the
	individual words.

	for fancier stuff, try

		generate-some-list-however-you-like | xargs cmd -options

	man xargs for the full poop.

-- 
things are more like they used to be than they are now.

will@serensoft.com *** http://www.dontUthink.com/



Reply to: