perl-data from file save to multidimensional array
i have a file,like
1 3
4 5
6 7
8 9
i want to save it into an array.
and then i want to get every element, because i want to use them to calculate. for example: i want to calculate 1 + 3.
but i cannot reach my goal.
it will show all rows. but i want only one element.
or
it is not yet correct.
anyone has ideas?
Last edited by pludi; 07-29-2010 at 12:32 PM..
Reason: code tags, please...
i'm trying to open a file with three or more columns and an undetermined, but finite number of rows. I want to define an array for each row with each element of the row as a sub array. The columns are separated by tabs or spaces.
Here's the file:
12x3.12z34b.342sd3.sds 454.23.23.232 ... (9 Replies)
Hello Experts,,
Can anybody give me a brief idea what is following bold letter statement is for!!
what is the term called so that I can google for it..
It seems to be an array inside another array..
awk'
/TXADDR/ { txaddr=$NF } ##understood
/TXDATA/ { txdata]=$NF... (1 Reply)
In a single dim. awk array, we can use :
<index> in <array name>
to determine whether a particualar index exists in the array or not.
Is there a way to achieve this in a awk multi dim. array ? (4 Replies)
Hi! I need to make dynamic multidimensional arrays using the vector class. I found in this page How to dynamically create a two dimensional array? - Microsoft: Visual C++ FAQ - Tek-Tips the way to do it in 2D, and now i'm trying to expand it to 3D but i don't understand how is the operator working,... (0 Replies)
I'm currently working with dozens of FASTA files, and I'm tired of having to manually change the filename in my Perl script.
I'm trying to write a simple Perl script that'll create a 2-dimensional array containing the name of the folders and its contents.
For example, I would like the output... (6 Replies)
Hi,
I was trying to process a file with the help of awk. I want to first display all the rows that contains 01 and at the end of processing I have to print some portion of all the lines. like below.
Output expected: (2 Replies)
#!/usr/local/bin/perl
use DBI;
use File::Copy;
use Time::Local;
use Data::Dumper;
-Comments Describing what I'm doing--------------
-I'm pulling information from a database that has an ID and Name. They are separated by a space and I'm trying to load them into a multidimensional array so as... (3 Replies)
I am learning about bash system variables, such as $ , @ and #.
I have this piece of script implementing an array and it is doing its job just fine.
This is not the only array I will be using.
Just for ease of maintenance and more coding I would like to have the arrays in two dimensional... (4 Replies)
Hello
I have a problem.
I create a Multidimensional Array Like this:
ENTRY="$kunnum-$host"
ENTRY="$host"
ENTRY="# $3"
for key in "${!ENTRY}"; do
ENTRIES=${ENTRY} # INDEX=IP(5)
donedeclare -p
declare -A ENTRIES=(="unas15533" ="unas" ="# RDP-Terminal 2"... (12 Replies)
Discussion started by: Marti95
12 Replies
LEARN ABOUT NETBSD
getgrouplist
GETGROUPLIST(3) BSD Library Functions Manual GETGROUPLIST(3)NAME
getgrouplist, getgroupmembership, -- calculate group access list
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
int
getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroups);
int
getgroupmembership(const char *name, gid_t basegid, gid_t *groups, int maxgrp, int *ngroups);
DESCRIPTION
The getgrouplist() and getgroupmembership() functions read through the group database and calculate the group access list for the user speci-
fied in name. The basegid is automatically included in the groups list. Typically this value is given as the group number from the password
database.
The resulting group list is returned in the integer array pointed to by groups.
For getgrouplist(), the caller specifies the size of the groups array in the integer pointed to by ngroups.
For getgroupmembership(), the caller specifies the size of the groups array in maxgrp.
The actual number of groups found is returned in ngroups.
Duplicate group ids will be suppressed from the result.
RETURN VALUES
The getgrouplist() and getgroupmembership() functions return 0 if successful, and return -1 if the size of the group list is too small to
hold all the user's groups. In the latter case, the groups array will be filled with as many groups as will fit and ngroups will contain the
total number of groups found.
FILES
/etc/group group membership list
SEE ALSO setgroups(2), initgroups(3), group(5)HISTORY
The getgrouplist() function first appeared in 4.4BSD. The getgroupmembership() function first appeared in NetBSD 3.0 to address an API defi-
ciency in getgrouplist().
BUGS
The getgrouplist() function uses the routines based on getgrent(3). If the invoking program uses any of these routines, the group structure
will be overwritten in the call to getgrouplist().
BSD January 6, 2005 BSD