06-04-2013
Thanks, using your approach , i could achieve the desired result.I have set flags for each condition and iterated it to next field.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
HI....
It's fallow up file ..
#./show.sh click enter button.. i am gettng the fallowup file. its keep on running every time why because there are lots of users working on it.
In that file i want to search pattern between two words
for ex:
SELECT DISTINCT... (7 Replies)
Discussion started by: ksr.test
7 Replies
2. Shell Programming and Scripting
Hi,
I know how to use awk to search some expressions like five consecutive numbers, , this is easy.
However, how do I make awk print the pattern that is been matched?
For example:
input: usa,canada99292,japan222,france59664,egypt223
output:99292,59664 (6 Replies)
Discussion started by: grossgermany
6 Replies
3. UNIX for Dummies Questions & Answers
Hi !
I have a tab-delimited file, file.tab:
Column1 Column2 Column3
aaaaaaaaaa bbtomatoesbbbbbb cccccccccc
ddddddddd eeeeappleseeeeeeeee ffffffffffffff
ggggggggg hhhhhhtomatoeshhh iiiiiiiiiiiiiiii
... (18 Replies)
Discussion started by: lucasvs
18 Replies
4. Shell Programming and Scripting
i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies
5. Shell Programming and Scripting
Hi,
I am writing a shell script to parse some files, and gather data.
The data in the files is displayed as below.
.......xyz: abz: ......
.......xyz: abz: .....
I have tried using awk and cut, bu the position of these values keep changing, so I can use awk and split it into columns. ... (14 Replies)
Discussion started by: Serena
14 Replies
6. Shell Programming and Scripting
I have
2013-06-11 23:55:14 1Umexd-0004cm-IG <= user@domain.com
I need sed/awk operation on this, so that it should print the very next pattern only after the the pattern mach <=
ie only print user@domain.com (7 Replies)
Discussion started by: anil510
7 Replies
7. Shell Programming and Scripting
Ive used this snippet of code on a solaris box thousands of times.
But it isnt working on the new linux box
sed -n '/interface LoopBack0/{N;/ ip address /p;}' *.conf
its driving me nuts !!
Is there something Im missing ? (7 Replies)
Discussion started by: popeye
7 Replies
8. Shell Programming and Scripting
Im using the command below , but thats not the output that i want. it only prints the odd and even numbers.
awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}'
Im hoping for something like this
file1:
Text hi this is just a test
text1 text2 text3 text4 text5 text6
Text hi... (2 Replies)
Discussion started by: invinzin21
2 Replies
9. Shell Programming and Scripting
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies
10. Shell Programming and Scripting
The intended result should be :
PDF converters
'empty line'
gpdftext and pdftotext?xml version="1.0"?>
xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters
gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies
LEARN ABOUT PHP
mongocollection.findone
MONGOCOLLECTION.FINDONE(3) 1 MONGOCOLLECTION.FINDONE(3)
MongoCollection::findOne - Queries this collection, returning a single element
SYNOPSIS
public array MongoCollection::findOne ([array $query = array()], [array $fields = array()], [array $options = array()])
DESCRIPTION
As opposed to MongoCollection.find(3), this method will return only the first result from the result set, and not a MongoCursor that can
be iterated over.
PARAMETERS
o $query
- The fields for which to search. MongoDB's query language is quite extensive. The PHP driver will in almost all cases pass the
query straight through to the server, so reading the MongoDB core docs on find is a good idea.
Warning
Please make sure that for all special query operaters (starting with $) you use single quotes so that PHP doesn't try to
replace "$exists" with the value of the variable $exists.
o $fields
- Fields of the results to return. The array is in the format array('fieldname' => true, 'fieldname2' => true). The _id field is
always returned.
o $options
- This parameter is an associative array of the form array("name" => <value>, ...). Currently supported options are:
o "maxTimeMS"Specifies a cumulative time limit in milliseconds for processing the operation (does not include idle time). If
the operation is not completed within the timeout period, a MongoExecutionTimeoutException will be thrown.
RETURN VALUES
Returns record matching the search or NULL.
ERRORS
/EXCEPTIONS
Throws MongoConnectionException if it cannot reach the database.
CHANGELOG
+--------+------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+------------------------------------+
| 1.5.0 | |
| | |
| | Added optional $options argument. |
| | |
+--------+------------------------------------+
EXAMPLES
Example #1
MongoCollection::findOne document by its id.
This example demonstrates how to find a single document in a collection by its id.
<?php
$articles = $mongo->my_db->articles;
$article = $articles->findOne(array('_id' => new MongoId('47cc67093475061e3d9536d2')));
?>
Example #2
MongoCollection::findOne document by some condition.
This example demonstrates how to find a single document in a collection by some condition and limiting the returned fields.
<?php
$users = $mongo->my_db->users;
$user = $users->findOne(array('username' => 'jwage'), array('password'));
print_r($user);
?>
The above example will output something similar to:
Array
(
[_id] => MongoId Object
(
)
[password] => test
)
Notice how even though the document does have a username field, we limited the results to only contain the password field.
SEE ALSO
MongoCollection.find(3), MongoCollection.insert(3), MongoDB core docs on find..
PHP Documentation Group MONGOCOLLECTION.FINDONE(3)