07-14-2009
Group the output of the variable
Hi Guys,
First time in scripting & first time here...
I need help in this situation -
My requirements is:
I have a list e.g.
list=`echo ls -l *` OR
list=`sql.... select emp_id from employee ...`
The Input is:
ls -l OR emp_id
A 4567
B 2231
C 1121
D 2233
E 4554
F 3243
G 1231
H 3311
What I want the output would be:
if the output count of the list -gt 7 then group the list by 4 (group=4), if the output count is -lt 7 group the list by 2 (group=2)
A group1 4567 group1
B group1 2231 group1
C group2 1121 group2
D group2 2233 group2
E group3 4554 group3
F group3 3243 group3
G group4 1231 group4
H group4 3311 group4
I hope some gurus can help me on this.
Thanx a bunch in advance!!!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a script that puts out a list that looks like this:
bb1 newyork
bb1 pittsburg
bb2 seattle
bb2 spokane
sl1 sacramento
I want to seperate the output so that it instead has a space between each group so like this:
bb1 newyork
bb1 pittsburg
bb2 seattle
bb2 spokane
sl1... (8 Replies)
Discussion started by: llsmr777
8 Replies
2. Shell Programming and Scripting
Hi,
Need awk help to group and print lines to format the output as shown below
INPUT FORMAT
set echo on
set heading on
set spool on
/* SCHEMA1 */ CREATE TABLE T1;
/* SCHEMA1 */ CREATE TABLE T2;
/* SCHEMA1 */ CREATE TABLE T3;
/* SCHEMA1 */ CREATE TABLE T4;
/* SCHEMA1 */ CREATE TABLE T5;... (5 Replies)
Discussion started by: rajan_san
5 Replies
3. UNIX for Dummies Questions & Answers
I have a script on all the machines on my network that lists how many updates are available for each machine, and then outputs the answer to a file called updates.txt
the output shows the hostname and the number of updates, like: computer_A 7
I want all these machines to output the data to... (1 Reply)
Discussion started by: glev2005
1 Replies
4. Shell Programming and Scripting
Hi Guys,
This is based on my question previously posted. :)
I have my shell script like this:
#!/usr/bin/sh
e_id=`sqlplus -s scott/tiger@DB<<eof
SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF;
select emp_id from employee;
quit
... (1 Reply)
Discussion started by: alvingo
1 Replies
5. Shell Programming and Scripting
Hi All,
Second time to post on this group :)
I'm pulling my hair now 'coz I'm so dumb to produce this requirement.
Requirement: I want to run a utility by limiting the no. inside my process (mov##) to be able to use in multi streaming.
Here is my script:
--Input: "user_list.txt"... (0 Replies)
Discussion started by: alvingo
0 Replies
6. Shell Programming and Scripting
Hi all,
Hope someone can help me out here.
I have this BASH script (see below)
My problem lies with the variable path.
The output of the command find will give me several fields. The 9th field is the path. I want to captured that and the I want to filter this to a specific level.
The... (6 Replies)
Discussion started by: Cowardly
6 Replies
7. Shell Programming and Scripting
Hello,
I am currently a little bit lost with my new shell-script.
I am trying to output the results of the "id"-command as a "one per line" statement. For example:
I have the user "test" with the group-memberships "group1, group2, group3". When I enter "id test" it will show me the output... (2 Replies)
Discussion started by: henryford
2 Replies
8. Shell Programming and Scripting
Hi,
My Oracle query is returing below o/p
----------------------------------------------------------
Ins trnas value
a lkp1 x
a lkp1 y
b lkp1 a
b lkp2 x
b lkp2 y ... (7 Replies)
Discussion started by: gvk25
7 Replies
9. UNIX for Advanced & Expert Users
Is it possible to set an environment variable or add something to the path for every user in a group?
I guess I mean the equivelent of going into each member's profile and adding a directory to their path var, but without physically doing that for each of them.
So just set it globally the... (4 Replies)
Discussion started by: steadyonabix
4 Replies
10. UNIX for Advanced & Expert Users
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
LEARN ABOUT OSX
mpi_group_compare
MPI_Group_compare(3OpenMPI) MPI_Group_compare(3OpenMPI)
NAME
MPI_Group_compare - Compares two groups.
SYNTAX
C Syntax
#include <mpi.h>
int MPI_Group_compare(MPI_Group group1, MPI_Group group2,
int *result)
Fortran Syntax
INCLUDE 'mpif.h'
MPI_GROUP_COMPARE(GROUP1, GROUP2, RESULT, IERROR)
INTEGER GROUP1, GROUP2, RESULT, IERROR
C++ Syntax
#include <mpi.h>
static int Group::Compare(const Group& group1, const Group& group2)
INPUT PARAMETERS
group1 First group (handle).
group2 Second group (handle).
OUTPUT PARAMETERS
result Integer which is MPI_IDENT if the order and members of the two groups are the same, MPI_SIMILAR if only the members are the same,
and MPI_UNEQUAL otherwise.
IERROR Fortran only: Error status (integer).
DESCRIPTION
MPI_IDENT results if the group members and group order is exactly the same in both groups. This happens for instance if group1 and group2
are the same handle. MPI_SIMILAR results if the group members are the same but the order is different. MPI_UNEQUAL results otherwise.
ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ func-
tions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism
will be used to throw an MPI:Exception object.
Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for
I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be
used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.
Open MPI 1.2 September 2006 MPI_Group_compare(3OpenMPI)