Sponsored Content
Full Discussion: Change value for POSIX
Top Forums UNIX for Advanced & Expert Users Change value for POSIX Post 303002707 by Abhayman on Thursday 31st of August 2017 03:54:50 AM
Old 08-31-2017
Hi,

I am using Bash shell.

I have set of Ids stored in a file and I am copying them in batches in array.


Code:
# Store Distinct ContainerIds  in Array
distinct_array=`sed ':a;N;$!ba;s/\n/ /g' output/EmployeeId_distinct.txt`
declare -a arr=($distinct_array)
echo " Total Number of Distinct Ids Stored in Array ${#arr[@]}"
batchsize=200


This is how I am calling the mongo

Code:
for((i=0; i < ${#arr[@]}; i+=batchsize))
 do
   IFS=,
   part=( "${arr[@]:i:batchsize}" )
  
   sed -i  "2i permissibleCars = [  ${part[*]} ]"  query/employee_Id_count.js
   mongo localhost:27045/employee_db -u user_user -p password123 < query/employee_Id_count.js >> output/employee_Id_count.txt 
   cat query/employee_Id_count.js >> query/employee_Id_count_total.js
done


My sample employee id would be like "XYZ:16772767:586748411"

mployee_Id_count.js file :--

Code:
DBQuery.shellBatchSize = 224361901 ; 
permissibleCars = ["XYZ:16772767:58675748411" ..... more 200 ids ]
db.getCollection('employee_contracts_nrt').aggregate([
{$match:
      {         employeeClass : "ownload",
                    EmployeeId: {"$in": permissibleCars},
                                "methods.name": "image",
                "methods.status": "ACTIVE"

        } },
{"$group" : {_id:"$EmployeeId", count:{$sum:1}}}
],
{ allowDiskUse: true}
);

It works perfectly fine if I pass say 150 batchsize but if crosses 4096 bytes it starts failing.


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 08-31-2017 at 05:07 AM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Posix and linux

What is posix? What is the relation between Posix, Unix and linux? (1 Reply)
Discussion started by: darbarilal
1 Replies

2. Programming

ANSI C vs POSIX

can somebody explain about the ANSI C vs POSIX. say i was using open and fopen, i know that open is POSIX, and fopen is ANSI C. i read that that POSIX is a system call and ANSI C is like a standard library function. wouldn't the fopen function has to call on open function anyway to open any kind... (2 Replies)
Discussion started by: bb00y
2 Replies

3. Programming

Unix(posix)

Please,does anybody can give me any general info about unix(posix) ? (1 Reply)
Discussion started by: Haris Astreos
1 Replies

4. UNIX for Dummies Questions & Answers

how to read POSIX?

how to read POSIX? poe six or not? (3 Replies)
Discussion started by: robin.zhu
3 Replies

5. Programming

POSIX threads

Hello ! Let's supose I have a main function in C , and two POSIX threads. I give you an example down : int main() { int something; char else; void *FirstThread(); void *SecondThread(); .. <start those two pthreads ..> return 0;} void *FirstThread() { ... } void *SecondThread()... (2 Replies)
Discussion started by: !_30
2 Replies

6. Programming

Posix

HI, When i am configuring php in SUN Solaris. I am getting the below error. configure: error: Your system seems to lack POSIX threads. Do i need to install POSIX? If so can somebody let me know where can i download POSIX for Solaris 8? Thanks, (2 Replies)
Discussion started by: Krrishv
2 Replies

7. UNIX for Advanced & Expert Users

Posix threads

Hi, consider the code below: #include <stdio.h> . . struct myStruct { char *message ; int id; }; . . . void *thread_function( void *ptr ); nt main() { pthread_t thread1, thread2 ,thread3 ; struct myStruct nico1; (2 Replies)
Discussion started by: Behnaz
2 Replies

8. UNIX for Advanced & Expert Users

System V or POSIX

Hi , I am using UNIX network programming Vol1 (by R Stevens) book to learn about IPC. I would be using HP-UX,Solaris and Linux at my work. I have sections for POSIX and for System V in that book. I am quite confused in indentifying those OSs as POSIX or SYstem V. Can anyone please... (1 Reply)
Discussion started by: kumaran_5555
1 Replies

9. Programming

POSIX Thread Help

I want to create a program that creates 2 child process, and each of them creates 2 threads, and each thread prints its thread id. I0ve allread done that the outuput isn't the outuput i want. When a run the following comand "$./a.out | sort -u | wc -l" I have the folowing output 2 $: It should... (3 Replies)
Discussion started by: pharaoh
3 Replies

10. OS X (Apple)

POSIX compliance...

Thanks to all you guys about posix compliance I have learnt an enormous amount over the last few days. I have written a program that is an Egg Timer with simple animation. I now realise how sophisticated 'bash' is compared to full posix compliance. The code below has passed all of the tests from... (11 Replies)
Discussion started by: wisecracker
11 Replies
LOCALE_GET_ALL_VARIANTS(3)						 1						LOCALE_GET_ALL_VARIANTS(3)

Locale::getAllVariants - Gets the variants for the input locale

	Object oriented style

SYNOPSIS
publicstatic array Locale::getAllVariants (string $locale) DESCRIPTION
Procedural style array locale_get_all_variants (string $locale) Gets the variants for the input locale PARAMETERS
o $locale - The locale to extract the variants from RETURN VALUES
The array containing the list of all variants subtag for the locale or NULL if not present EXAMPLES
Example #1 locale_get_all_variants(3) example <?php $arr = locale_get_all_variants('sl_IT_NEDIS_ROJAZ_1901'); var_export( $arr ); ?> Example #2 OO example <?php $arr = Locale::getAllVariants('sl_IT_NEDIS_ROJAZ_1901'); var_export( $arr ); ?> The above example will output: array ( 0 => 'NEDIS', 1 => 'ROJAZ', 2 => '1901', ) SEE ALSO
locale_get_primary_language(3), locale_get_script(3), locale_get_region(3). PHP Documentation Group LOCALE_GET_ALL_VARIANTS(3)
All times are GMT -4. The time now is 10:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy