Almost giving me the right output, sorry for confusion, in file one, there is no repeating for the field, so it appear only one. Only in file 2 that it can repeat. And the calculation I think is a bit off since line without $ and without 2 numbers after decimal points are treated as invalid, so nothing should be done. Here what I test with the code:
What I think my desired output is:
hi all i am trying to save an awk value into an array in bash:
total=`awk '{sum+=$3} END {print sum}' "$count".txt"`
((count++))
the above statement is in a while loop..
$count is to keep track of file numbers (1.txt,2.txt,3.txt,etc.)
i get the following error:
./lines1:... (1 Reply)
hi i am trying to save the values i extract from a file with the help of awk in a bash shell array.
i have:
exec 10<file2
while read LINE <&10; do
ARRAY1=$(awk '{print $1}' file2)
((count++))
done
echo ${ARRAY1}
it prints just blank lines. file1 has two columns and i... (4 Replies)
hi i am trying to save values in a file in an array in awk..the file is as follows:
0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,
so far i have this:
awk 'BEGIN {RS="\n";FS=","}
{
for(i=1;i<=NR;i++)
{
for(j=1;j<=NF;j++)
{
a=$j;
}
} (4 Replies)
Hi Everyone,
#!/usr/bin/perl
use strict;
use warnings;
my @test=("a;b;qqq;c;d","a;b;ggg;c;d","a;b;qqq;c;d");
would like to split the @test array into two array:
@test1=(("a;b;qqq;c;d","a;b;qqq;c;d"); and @test2=("a;b;ggg;c;d");
means search for 3rd filed.
Thanks
find the... (0 Replies)
Hi, im new to shell scripting. i have a query for which i have searched your forums but coulndt get what i need.
i have a file that has two records of exactly the same length and format and they are comma seperated. i need to save the first and the second columns of the input file to 2 different... (11 Replies)
Good day all
I need some helps,
say that I have data like below, each field separated by a tab
DATE NAME ADDRESS
15/7/2012 LX a.b.c
15/7/2012 LX1 a.b.c
16/7/2012 AB a.b.c
16/7/2012 AB2 a.b.c
15/7/2012 LX2 a.b.c... (2 Replies)
Hi ,
I have been trying to write a perl script to do this job. But i am not able to achieve the desired result. Below is my code.
my $current_value=12345;
my @users=("bob","ben","tom","harry");
open DBLIST,"<","/var/tmp/DBinfo";
my @input = <DBLIST>;
foreach (@users)
{
my... (11 Replies)
In the below awk I am splitting $7 on the : and then counting each line or NM_xxxx. If the $1 value is the same for each line then print the $7 that occurs the most with the matching $1 value. The awk seems close but I am not sure what is going on. I included a description as well as to what I... (1 Reply)
I will start with an example of what I'm trying to do and then describe how I am approaching the issue.
File
PS028,005
Lexeme HRS # M #
PhraseType 1(1:1) 7(7)
PhraseLab 501 503
ClauseType ZYq0
PS028,005
Lexeme W # L> # BNH # M #... (17 Replies)
Discussion started by: jvoot
17 Replies
LEARN ABOUT OPENSOLARIS
mp_setlogicalunitloadbalancetype
MP_SetLogicalUnitLoadBalanceType(3MPAPI) Common Multipath Management Library Functions MP_SetLogicalUnitLoadBalanceType(3MPAPI)NAME
MP_SetLogicalUnitLoadBalanceType - set a load balancing policy
SYNOPSIS
cc [ flag... ] file... -lMPAPI [ library... ]
#include <mpapi.h>
MP_STATUS MP_SetLogicalUnitLoadBalanceType(MP_OID logicalUnitoid,
MP_LOAD_BALANCE_TYPE loadBalance);
PARAMETERS
logicalUnitOid The object ID of the multipath logical unit.
loadBalance The desired load balance policy for the specified logical unit.
DESCRIPTION
The MP_SetLogicalUnitLoadBalanceType() function sets the multipath logical unit's load balancing policy. The value must correspond to one
of the supported values in MP_PLUGIN_PROPERTIES.SupportedLogicalUnitLoadBalanceTypes.
RETURN VALUES
MP_STATUS_INVALID_OBJECT_TYPE
The logicalUnitOid does not specify any valid object type. This is most likely to happen if an uninitialized object ID is passed to the
API.
MP_STATUS_INVALID_PARAMETER
The loadBalance is invalid or logicalUnitOid has a type subfield other than MP_OBJECT_TYPE_MULTIPATH_LU.
MP_STATUS_OBJECT_NOT_FOUND
The logicalUnitOid owner ID or object sequence number is invalid.
MP_STATUS_SUCCESS
The operation is successful.
MP_STATUS_FAILED
The specified loadBalance type cannot be handled by the plugin. One possible reason for this is a request to set MP_LOAD_BAL-
ANCE_TYPE_PRODUCT when the specified logical unit has no corresponding MP_DEVICE_PRODUCT_PROPERTIES instance (i.e., the plugin does not
have a product-specific load balance algorithm for the LU product).
MP_STATUS_UNSUPPORTED
The implementation does not support the API.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard: ANSI INCITS 412 |
| |Multipath Management API |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO libMPAPI(3LIB), attributes(5)
Multipath Management API Version 1.0
SunOS 5.11 15 Feb 2006 MP_SetLogicalUnitLoadBalanceType(3MPAPI)