12-30-2015
Executing several commands in a text file
I have a file that has about 3000 commands , listed one below the other. I would like to execute them all in one go. Is there a simpler way to do it - like a batch file processing, than executing one line at a time?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a SQL script that requires values from the environment in order to execute. I found a way to get the desired results but my process is a little choppy. Any suggestions on how to clean this up would be greatly appreciated.
SQL Script
-------------
select a, b, c
from d
where a =... (1 Reply)
Discussion started by: bmopal
1 Replies
2. Red Hat
Hi Folks,
I have a small doubt, the binary commands under /bin and /sbin as well as other path binary files, if you peek deep into that, you can find the difference in the way of normal perl programming and some commands will be like binary files. how are the commands executing like the... (3 Replies)
Discussion started by: gsiva
3 Replies
3. Shell Programming and Scripting
Hi,
I want to run these two commands one after the other.
awk 'BEGIN {OFS="\t"} {print $2}'
sort -u
rather than typing awk 'BEGIN {OFS="\t"} {print $2}' file1 > file2, then sort -u file2 > file3. Is it possible to run both commands on file1 then get output file3?
Its kinda hard for... (5 Replies)
Discussion started by: kylle345
5 Replies
4. Shell Programming and Scripting
I need to execute a command to run my script several times with varying parameters
perl ex.pl -b 130198 -e 130884 -c plot plot.txt 1_plot.txt
perl ex.pl -b 1345 -e 1308 -c plot plot.txt 2_plot.txt
perl ex.pl -b 1345567 -e 130898 -c plot plot.txt 3_plot.txt
.
.
.
100's of excutions
... (2 Replies)
Discussion started by: Lucky Ali
2 Replies
5. Shell Programming and Scripting
Hi!
I am trying to create a script to reorder the contents of a text file. Below is the text file initially, followed by how I would like it reordered:
File initially:
---
Initial lines with text and/or numbers
Initial lines with text and/or numbers
Initial lines with text and/or numbers... (11 Replies)
Discussion started by: gwr
11 Replies
6. Shell Programming and Scripting
Hi,
I have a question here. Please suggest.
I have a file which has some unix commands to be executed through shell scripting. The number of commands will be different every time based on some external instructions i received. I manually keep the instuctions in this file.
i need to execute... (1 Reply)
Discussion started by: rbalaj16
1 Replies
7. Shell Programming and Scripting
hi,
I am trying to call a text file in a shell script.
The text file has the variable defind like..
export vari_namee=/path/give/here
-------------------------------------------------
I am able to execute the shell script through putty.
But when I try to execute with informatica... (1 Reply)
Discussion started by: sunil0106
1 Replies
8. Shell Programming and Scripting
Hi
Am having file.ksh as below
wc -l file1.txt
wc -l file2.txt
wc -l file3.txt
wc -l file4.txt
i want all the commands in this file to execute in same time
please help
Thanks in advance (1 Reply)
Discussion started by: ragu.selvaraj
1 Replies
9. Linux
Hello,
I have standard loop
while read -r info; do
command $info
done < info
in info text file I have multiple commands each on line that I want to execute. When I used them in console they worked, but not with this loop.
This is one of the commands in info file:
grep... (4 Replies)
Discussion started by: adamlevine
4 Replies
10. Shell Programming and Scripting
I have a script that checks if the script has been ran with sudo.
If the script is not ran as sudo, the current script is being executed with exec sudo bash.
You are asked for a password, you type in the password, success. Everything is perfect - the commands inside the script are ran as sudo.... (1 Reply)
Discussion started by: boqsc
1 Replies
LEARN ABOUT PHP
mongowritebatch
MONGOWRITEBATCH(3) 1 MONGOWRITEBATCH(3)
The MongoWriteBatch class
INTRODUCTION
MongoWriteBatch is the base class for the MongoInsertBatch, MongoUpdateBatch and MongoDeleteBatch classes.
MongoWriteBatch allows you to "batch up" multiple operations (of same type) and shipping them all to MongoDB at the same time. This can be
especially useful when operating on many documents at the same time to reduce roundtrips.
Prior to version 1.5.0 of the driver it was possible to use MongoCollection::batchInsert, however, as of 1.5.0 that method is now discour-
aged.
Note: This class is only available when talking to MongoDB 2.6.0 (and later) servers. It will throw MongoProtocolException if attempting
to use it on older MongoDB servers.
CLASS SYNOPSIS
MongoWriteBatch
MongoWriteBatch
Constants
o const int$MongoWriteBatch::COMMAND_INSERT1
o const int$MongoWriteBatch::COMMAND_UPDATE2
o const int$MongoWriteBatch::COMMAND_DELETE3
Methods
o protected MongoWriteBatch::__construct (MongoCollection $collection, [string $batch_type], [array $write_options])
o public bool MongoWriteBatch::add (array $item)
o finalpublic array MongoWriteBatch::execute (array $write_options)
MONGOWRITEBATCH TYPES
o MongoWriteBatch::COMMAND_INSERT -Create an Insert Write Batch
o MongoWriteBatch::COMMAND_UPDATE -Create an Update Write Batch
o MongoWriteBatch::COMMAND_DELETE -Create an Delete Write Batch
DESCRIPTION
When executing a batch, by calling MongoWriteBatch::execute, MongoWriteBatch will send over maxWriteBatchSize (defaults to 1000) documents
or up to maxBsonObjectSize (defaults to 16777216 bytes), whichever comes first.
Note
Documents will never be partially transferred. When adding documents to the batch, that overflows the limit, a new batch will be
created and the document put into the new batch.
ERRORS
/EXCEPTIONS
oException on parameter parsing failures
oException on argument validation errors (e.g. missing keys)
oMongoProtocolException when talking to MongoDB server older then 2.6.0.
oMongoProtocolException on socket errors.
oMongoWriteConcernException when a write fails due to WriteConcerns
EXAMPLES
Example #1
MongoWriteBatch example
Adding documents to a Insert batch and then execute it
<?php
$mc = new MongoClient("localhost");
$collection = $mc->selectCollection("test", "test");
$docs = array();
$docs[] = array("my" => "demo");
$docs[] = array("is" => "working");
$docs[] = array("pretty" => "well");
$batch = new MongoInsertBatch($collection);
foreach($docs as $document) {
$batch->add($document);
}
$retval = $batch->execute(array("w" => 1));
var_dump($retval);
?>
The above example will output:
array(2) {
["nInserted"]=>
int(3)
["ok"]=>
bool(true)
}
PHP Documentation Group MONGOWRITEBATCH(3)