You need to set big to something real, not $1. Safe to set to first value of the array.
You're right. That's the key.
Just for studying purposes, I've created two bash scripts using different for loop syntax for solving this problem.
Here we go:
Of course, there is more than a way for doing such things.
I suggest you give "Advanced Bash-Scripting Guide" a try. It's a really good and powerful book about Bash Scripting. You may download it for free here:
Hope it helps.
This User Gave Thanks to chapeupreto For This Post:
Hi,
My input file contain list of username, and it may have name with number as a suffix (if duplicated).
Ex:
mary
john2
mike
john3
john5
mary10
alexa
So i want to check with a specific username (without suffix number) how many duplicated name, and what is the... (13 Replies)
Hi All,
My script is reading a log file line by line
log file is like ;
19:40:22 :INFO Total time taken to Service External Request---115ms
19:40:25 DEBUG : Batch processed libdaemon.x86_64 0-0.10-5.el5 - u
19:40:22 INFO Total time taken to Service External Request---20ms
19:40:24... (4 Replies)
Hey. This is pretty easy stuff but I'm learning the basics of Unix at the moment so keep that in mind. I have to:
1) Write a C-shell script to monitor user activity on the server for 13 minutes.
2) Then print the smallest and largest number of users during these 13 minutes.
I have this:
1)... (2 Replies)
morning guys and gals,
I am haveing a problem, a friend helped me out with this script but i dont know how to add incrementing number for each movie in movie.list. this is what i have so far. any assistance would be great.
I have removed the GT and LT symbols so you can see what is going on... (5 Replies)
Hi
I work in ksh88 and have a file which has several "set -A " statements:
set -A PNUM_LSTM 2713 4124 2635 270 2529 2259 2214
set -A PNUM_LSTM $*
for pn in ${PNUM_LSTM}
etc...
I need to add another number, lets say 555, to the first line ONLY so only the
the first line will be updated... (2 Replies)
Language: ksh
OS: SunOS
I have been getting the 'subscript out of range' error when the below array variable gets elements greater that 1024. I understand that 1024 is the default size for 'set -A' dynamic array, but is there a way to initialize it with a larger number?
set -A arr `grep... (6 Replies)
I have two text files like this:
file1.txt:
133 10
133 22
133 13
133 56
133 78
133 98
file2.txt:
158 38
158 67
158 94
158 17
158 23
I'm basically trying to have awk check the second largest value of the second column of each text file, and cat it to its own text file. There... (13 Replies)
Hello all,
I'm new to the forums and hope to be able to contribute something useful in the future; however I must admit that what has prompted me to join is the fact that currently I need help with something that has me at the end of my tether.
I have a PDB (Protein Data Bank) file which I... (13 Replies)
I have a tab delimited file with the following format
1 r 109 45 3 5 6 7
2 f 300 249 5 8 10
3 g 120 4 5 110 0
4 t 400 300 250 0 0
.....
.....
100,000 lines
I would like to get the largest number in columns 4, 5, 6, 7, 8 and divide that largest number with the number in column 3.... (4 Replies)
I have the following code to count the number of how many times the name occurred in one file. The code is working fine and the output is exactly what I want. The problem is the real code has more than 50 names in function listname which cause function name to have more than 50 case ,and function... (14 Replies)
Discussion started by: samsan
14 Replies
LEARN ABOUT OPENSOLARIS
freeipsecalgent
getipsecalgbyname(3NSL) Networking Services Library Functions getipsecalgbyname(3NSL)NAME
getipsecalgbyname, getipsecalgbynum, freeipsecalgent - query algorithm mapping entries
SYNOPSIS
cc -flag ... file ...-lnsl [ -library ... ]
#include <netdb.h>
struct ipsecalgent *getipsecalgbyname
(const char *alg_name, int protocol_num, int *errnop
struct ipsecalgent *getipsecalgbynum(int alg_num, int protocol_num,
int *errnop
void freeipsecalgent(struct ipsecalgent *ptr
DESCRIPTION
Use the getipsecalgbyname(), getipsecalgbynum(), freeipsecalgent() functions to obtain the IPsec algorithm mappings that are defined by
ipsecalgs(1M). The IPsec algorithms and associated protocol name spaces are defined by RFC 2407.
getipsecalgbyname() and getipsecalgbynum() return a structure that describes the algorithm entry found. This structure is described in the
RETURN VALUES section below.
freeipsecalgent() must be used by the caller to free the structures returned by getipsecalgbyname() and getipsecalgbynum() when they are no
longer needed.
Both getipsecalgbyname() and getipsecalgbynum() take as parameter the protocol identifier in which the algorithm is defined. See
getipsecprotobyname(3NSL) and getipsecprotobyname(3NSL).
The following protocol numbers are pre-defined:
IPSEC_PROTO_ESP Defines the encryption algorithms (transforms) that can be used by IPsec to provide data confidentiality.
IPSEC_PROTO_AH Defines the authentication algorithms (transforms) that can be used by IPsec to provide authentication.
getipsecalgbyname() looks up the algorithm by its name, while getipsecalgbynum() looks up the algorithm by its assigned number.
PARAMETERS
errnop A pointer to an integer used to return an error status value on certain error conditions. See ERRORS.
RETURN VALUES
The getipsecalgbyname() and getipsecalgbynum() functions return a pointer to the structure ipsecalgent_t, defined in <netdb.h>. If the
requested algorithm cannot be found, these functions return NULL.
The structure ipsecalgent_t is defined as follows:
typedef struct ipsecalgent {
char **a_names; /* algorithm names */
int a_proto_num; /* protocol number */
int a_alg_num; /* algorithm number */
char *a_mech_name; /* mechanism name */
int *a_block_sizes; /* supported block sizes */
int *a_key_sizes; /* supported key sizes */
int a_key_increment; /* key size increment */
} ipsecalgent_t;
If a_key_increment is non-zero, a_key_sizes[0] contains the default key size for the algorithm. a_key_sizes[1] and a_key_sizes[2] specify
the smallest and biggest key sizes support by the algorithm, and a_key_increment specifies the valid key size increments in that range.
If a_key_increment is zero, the array a_key_sizes contains the set of key sizes, in bits, supported by the algorithm. The last key length
in the array is followed by an element of value 0. The first element of this array is used as the default key size for the algorithm.
a_name is an array of algorithm names, terminated by an element containing a NULL pointer. a_name[0] is the primary name for the algo-
rithm.
a_proto_num is the protocol identifer of this algorithm. a_alg_num is the algorithm number. a_mech_name contains the mechanism name associ-
ated with the algorithm.
a_block_sizes is an array containing the supported block lengths or MAC lengths, in bytes, supported by the algorithm. The last valid
value in the array is followed by an element containing the value 0.
ERRORS
When the specified algorithm cannot be returned to the caller, getipsecalgbynam() and getipsecalgbynum() return a value of NULL and set the
integer pointed to by the errnop parameter to one of the following values:
ENOMEM Not enough memory
ENOENT Specified algorithm not found
EINVAL Specified protocol number not found
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsl (32 bit) |
| |SUNWcslx (64 bit) |
+-----------------------------+-----------------------------+
|MT Level |MT Safe |
+-----------------------------+-----------------------------+
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
SEE ALSO cryptoadm(1M), ipsecalgs(1M), getipsecprotobyname(3NSL), getipsecprotobyname(3NSL), attributes(5)
Piper, D. RFC 2407, The Internet IP Security Domain of Interpretation for ISAKMP. Network Working Group. November, 1998.
SunOS 5.11 20 Aug 2003 getipsecalgbyname(3NSL)