Hi,
I want keep/save one command's output in an array and later want to iterate over the array one by one for some processing. instead of doing like below-
want to store-
and then want to do-
shell is korn shell, sorry for syntax mistakes.
thanks in advance.
Last edited by Scott; 05-09-2013 at 11:02 AM..
Reason: Please use code tags
All ..
I am having a pointer array . And trying to store the addess into that pointer array . please see below the problem i faced
code:
int cnt1;
char *t_array;
char *f_array;
for(cnt1=0; cnt1<1000; cnt1++)
{
t_array =... (1 Reply)
Hi All,
I need some help with arrays. I need to take input from the user for hostname, username and password until he enters .(dot) or any other character and store the values in the variable array.
I would further connect to the hostname using username and passwd and copy files from server to... (7 Replies)
Hi all,
I am new to Linux/shell scripting having moderate knowledge.
In my script, I need to get execution time of a command (say 'ls') in mili seconds level. For this i tried using "time" command to retrieve the total execution time in milli seconds. But, the problem is that, how to save... (9 Replies)
Hello Guys,
I am trying to store output of command to an array and then want to print, but it showing an error that "bad substitution". I am not getting why it's happening.
Can anyone help me?
#!/usr/bin/sh
hr=0
min=0
i=1
last $1 | grep -w `date "+%b"` | grep -v '\(0:.*\)' | grep -vw sshd... (8 Replies)
I am trying to get userinput from stdin and store the lines in an array.
If i do this:
using a char **list to store strings
allocate memory to it
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv)
{
char *prog = argv;
char **linelist;
int... (5 Replies)
Hi
I am trying to store the output of a command into an array in perl script.
I am able to store but the problem is i am unable to print the array line with one line space. i mean i inserted the \n in loop ...but not getting the result.
I have written like this
#!/usr/bin/perl
@a =... (2 Replies)
Hi,
My aim is to get the md5 hash of a file and store it in a variable.
var1="md5sum file1"
$var1
The above outputs fine but also contains the filename, so somthing like this 243ASsf25 file1
i just need to get the first part and put it into a variable.
var1="md5sum file1"... (5 Replies)
Hi All,
I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise.
Eg :
Select 'Query 1 output' from dual;
Select 'Query 2 output' from dual;
I want to... (3 Replies)
Hi Community,
Would love to get some quick help on below requirement.
I am trying to process mpstat output from multiple blades of my server
I would like to assign this the output to an array and then use it for post processing. How can I use a two dimensional array and assign these value
... (23 Replies)
Discussion started by: sshark
23 Replies
LEARN ABOUT PHP
mongocommandcursor
MONGOCOMMANDCURSOR(3) 1 MONGOCOMMANDCURSOR(3)The MongoCommandCursor classINTRODUCTION
A command cursor is similar to a MongoCursor except that you use it for iterating through the results of a database command instead of a
normal query. Command cursors are useful for iterating over large result sets that might exceed the document size limit (currently 16MB) of
a single MongoDB.command(3) response.
While you can create command cursors using MongoCommandCursor.__construct(3) or the MongoCommandCursor.createFromDocument(3) factory
method, you will generally want to use command-specific helpers such as MongoCollection.aggregateCursor(3).
Note that the cursor does not "contain" the database command's results; it just manages iteration through them. Thus, if you print a cur-
sor (f.e. with var_dump(3) or print_r(3)), you will see the cursor object but not the result documents.
CURSOR STAGES
A MongoCommandCursor has two "life stages": pre- and post- command. When a cursor is created, it has not yet contacted the database, so it
is in its pre-command state. When the client first attempts to get a result (by calling MongoCommandCursor.rewind(3), directly or indi-
rectly), the cursor moves into the post-command state.
The command cursor's batch size and socket timeout may be configured in both the pre- and post- command states.
Example #1
Adding options to MongoCommandCursor
<?php
$cursor = new MongoCommandCursor(...);
$cursor = $cursor->batchSize( 4 );
foreach ($cursor as $result) {
var_dump($result);
}
?>
CLASS SYNOPSIS
MongoCommandCursor
MongoCommandCursorMongoCursorInterfaceIterator
Methods
o public MongoCommandCursor MongoCommandCursor::batchSize (int $batchSize)
o public MongoCommandCursor::__construct (MongoClient $connection, string $ns, array $command = array())
o publicstatic MongoCommandCursor MongoCommandCursor::createFromDocument (MongoClient $connection, string $hash, array $document)
o public array MongoCommandCursor::current (void )
o public bool MongoCommandCursor::dead (void )
o public array MongoCommandCursor::getReadPreference (void )
o public array MongoCommandCursor::info (void )
o public int MongoCommandCursor::key (void )
o public void MongoCommandCursor::next (void )
o public array MongoCommandCursor::rewind (void )
o public MongoCommandCursor MongoCommandCursor::setReadPreference (string $read_preference, [array $tags])
o public MongoCommandCursor MongoCommandCursor::timeout (int $ms)
o public bool MongoCommandCursor::valid (void )
SEE ALSO
o MongoDB::command
o MongoCollection::aggregateCursor
PHP Documentation Group MONGOCOMMANDCURSOR(3)