Yes that is correct, #3 uses exact strings, so it correctly identifies the right field, and the sub() in itself isn't the problem either, since iteration occurs over the fields and not over the key value pairs (therefore it can substititute multiple occurrences on one line), but the problem is in the replacement part, it was attempting to use sub() on the record instead of a direct assignment to the field, to avoid losing the file separators.
This adaptation should fix that:
Last edited by Scrutinizer; 06-16-2019 at 06:37 AM..
This User Gave Thanks to Scrutinizer For This Post:
Sir,
I want to check for the repation of a user address in a file i used || as my delimiter and want to check repetaip0n of the address that is mailid and then i have to use IMAP and all.
How can i do this...
I am in linux ...and my file is linux file.
... (5 Replies)
Hello,
Can someone kindy help me solve this problem..I am using SunOS shell script
I got a file A with following content:
This is my correct document. I wrote 111
This is my incorrect word , 222
This is my wrong statement 333
This is my correct document 444
This is my correct document 555... (9 Replies)
lets see if i can explain this in a good way.
im trying to replace some words in a file but i need to know what the words are that is beeing replaced. not sure if sed can do this.
file.name.something.1DATA01.something.whatever
sed "s/./.DATA?????/g"
need to know what the first . is... (2 Replies)
Hi all
I have a file with below content (content is variable whenever new product is launched). I need form a grep command like this
egrep "Unknown product|Invalid symboland so on"
How to do it using a script?
Unknown product
Invalid symbol
No ILX exch found
exceeds maximum size
AFX... (4 Replies)
I want to replace a certain pattern with the variable already defined.
e.g.
set path_verilog = /home/priya/bin/verilogfile
my file contents are :
verilog new
verilog is defined here verilog_path_comes
I am using the below command
sed 's/verilog_path_comes/'$path_verilog'/g' <filename>... (2 Replies)
Hi all,
I have 2 files:
species-names.txt
Abaca-bunchy-top-virus ((((Abaca-bunchy-top-virus((Babuvirus((Unassigned((Nanoviridae((Unassigned))))
Abutilon-mosaic-virus ((((Abutilon-mosaic-virus((Begomovirus((Unassigned((Geminiviridae((Unassigned))))... (2 Replies)
Hello,
I would like to change my setting in a file to the setting that user input.
For example, by default it is
ONBOOT=ON
When user key in "YES", it would be
ONBOOT=YES
--------------
This code only adds in the entire user input, but didn't replace it.
How do i go about... (5 Replies)
I have the file like this.
cat 123.txt
<p> <table border='1' width='90%' align='center' summary='Script output'> <tr><td>text </td> </tr> </table> </p>
I want to replace some tags and want the output like below. I tried with awk & sed commands. But no luck. Could someone help me on this?
... (4 Replies)
Hi All,
I need one help to replace particular words in file based on if finds another words in that file .
i.e.
my self is peter@king.
i am staying at north sydney.
we all are peter@king.
How to replace peter to sham if it finds @king in any line of that file.
Please help me... (8 Replies)
Discussion started by: Rajib Podder
8 Replies
LEARN ABOUT PHP
mongoexception
MONGOEXCEPTION(3) 1 MONGOEXCEPTION(3)The MongoException classINTRODUCTION
Default Mongo exception.
This covers a bunch of different error conditions that may eventually be moved to more specific exceptions, but will always extend Mon-
goException.
o The MongoSomething object has not been correctly initialized by its constructor Code: 0 Probably your Mongo object is not con-
nected to a database server.
o zero-length keys are not allowed, did you use $ with double quotes? Code: 1 You tried to save "" as a key. You generally should
not do this. "" can mess up subobject access and is used by MongoDB internally. However, if you really want, you can set
mongo.allow_empty_keys to true in your php.ini file to override this sanity check. If you override this, it is highly recommended
that you set error checking to strict to avoid string interpolation errors.
o '.' not allowed in key: <key> Code: 2 You attempted to write a key with '.' in it, which is prohibited.
o insert too large: <size>, max: <max> Code: 3 You're attempting to send too much data to the database at once: the database will
only accept inserts up to a certain size (currently 16 MB).
o no elements in doc Code: 4 You're attempting to save a document with no fields.
o size of BSON doc is <size> bytes, max <max>MB Code: 5 You're attempting to save a document that is larger than MongoDB can save.
o no documents given Code: 6 You're attempting to batch insert an empty array of documents.
o MongoCollection::group takes an array, object, or MongoCode key Code: 7 Wrong type parameter send to MongoCollection.group(3).
o field names must be strings Code: 8 You should format field selectors as array("field1" => 1, "field2" => 1, ..., "fieldN" => 1).
o invalid regex Code: 9 The regex passed to MongoRegex is not of the correct form.
o MongoDBRef::get: $ref field must be a string Code: 10
o MongoDBRef::get: $db field must be a string Code: 11
o non-utf8 string: <str> Code: 12 This error occurs if you attempt to send a non-utf8 string to the database. All strings going
into the database should be UTF8. See php.ini options for the transition option of quieting this exception.
o mutex error: <err> Code: 13 The driver uses mutexes for synchronizing requests and responses in multithreaded environments. This
is a fairly serious error and may not have a stack trace. It's unusual and should be reported to maintainers with any system
information and steps to reproduce that you can provide.
o index name too long: <len>, max <max> characters Code: 14 Indexes with names longer than 128 characters cannot be created. If you
get this error, you should use MongoCollection.ensureIndex(3)'s "name" option to create a shorter name for your index.
CLASS SYNOPSIS
MongoException
MongoExceptionextends
Exception
PHP Documentation Group MONGOEXCEPTION(3)