Test1.txt
Test.sh
From the code in the executing file, I would like each word in each line to be stored in an array. Later I would like the output to be printed out like below with more lines in the content, but each column of the line is limited to 3.
Subject Verb Adjective
Tom is hot
Jane is sweet
..............................................
I tried executing the code, but it seems that no value is stored into the array....I printed out the number of array in store and it shows 0....... How to split the string and append into the array?
I have been working on some code for a while, that will parse a log file, look for a specified time discrepancy between entries, and then print that line +/- n other lines out to a file...
#!/bin/bash
file=$1 # The input log file
maxTime=$2 # The time discrepancy to look for
n=$3 ... (1 Reply)
Hi,
Is there any way to convert a string into an array in KSH? In other words I want to split the string like this:
STRING="one two three four"
into an array of 4 values splitting on white space. The array should be similar to the one that would be created with the following command:
... (3 Replies)
i have these values inside variable $blah
BUNGA TERATAI 3 5055 ITH 1 0 0 0 1 1
JADE TRADER 143W ITH 4 0 0 0 4 4
MOL SPLENDOR 0307A ITH 3 0 0 0 3 3
so how do I split them into array with the... (4 Replies)
I want to run an awk split on a value that has been pushed through an array and I was wondering what the syntax should be??
e.g. running time strings through an array and trying to examine just minutes:
12:25:30
10:15:13
08:55:23
awk '
NR==FNR{
... (2 Replies)
I have an array and two variables as below,
I need to check if $datevar is present in $filename.
If so, i need to replace $filename with the values in the array.
I need the output inside an ARRAY
How can this be done.
Any help will be appreciated. Thanks in advance. (2 Replies)
Hi all,
I want to split a string into array based on given delimiter, for example:
String:
"foo|bar|baz"
with delimiter "|"
into array:
strArr to strArr with values foo, bar and baz.
Thanks a lot.
Roy987 (5 Replies)
Hi
Input:
{ committed = 782958592; init = 805306368; max = 1051394048; used = 63456712; }
Result:
A map (maybe Associative Array) where I can iterate through the key/value. Something like this:
for key in $map
do
echo key=$key value=$map
done
Sample output from the map:
... (2 Replies)
value=malayalam
# i need to store the value in an array by splitting the character
#the output i need is
m
a
l
a
y
a
l
a
m
Please use CODE tags for output data as well as required by forum rules! (5 Replies)
Discussion started by: Meeran Rizvi
5 Replies
LEARN ABOUT PHP
mongogridfs.storefile
MONGOGRIDFS.STOREFILE(3) 1 MONGOGRIDFS.STOREFILE(3)MongoGridFS::storeFile - Stores a file in the database
SYNOPSIS
public mixed MongoGridFS::storeFile (string|resource $filename, [array $metadata = array()], [array $options = array()])
DESCRIPTION PARAMETERS
o $filename
- Name of the file or a readable stream to store.
o $metadata
- Other metadata fields to include in the file document.
Note
These fields may also overwrite those that would be created automatically by the driver, as described in the MongoDB core
documentation for the files collection. Some practical use cases for this behavior would be to specify a custom chunkSize or
_id for the file.
o $options
- An array of options for the insert operations executed against the chunks and files collections. See MongoCollection.insert(3)
for documentation on these these options.
RETURN VALUES
Returns the _id of the saved file document. This will be a generated MongoId unless an _id was explicitly specified in the $metadata param-
eter.
ERRORS /EXCEPTIONS
Throws MongoGridFSException if there is an error reading $filename or inserting into the chunks or files collections.
EXAMPLES
Example #1
MongoGridFS.storeFile(3) with additional metadata
<?php
$m = new MongoClient();
$gridfs = $m->selectDB('test')->getGridFS();
$id = $gridfs->storeFile('example.txt', array('contentType' => 'plain/text'));
$gridfsFile = $gridfs->get($id);
var_dump($gridfsFile->file);
?>
The above example will output something similar to:
array(7) {
["_id"]=>
object(MongoId)#6(0) {
}
["contentType"]=>
string(10) "plain/text"
["filename"]=>
string(11) "example.txt"
["uploadDate"]=>
object(MongoDate)#7(0) {
}
["length"]=>
int(26)
["chunkSize"]=>
int(262144)
["md5"]=>
string(32) "c3fcd3d76192e4007dfb496cca67e13b"
}
SEE ALSO MongoGridFS.put(3), MongoGridFS.storeBytes(3), MongoGridFS.storeUpload(3), MongoDB core docs on GridFS.
PHP Documentation Group MONGOGRIDFS.STOREFILE(3)