Hi,
I am writing a BASH shell script. I have an array that will contain IN ANY ORDER the following elements: DAY 8D MO NS.
I would like to erase the element DAY, but since the order of the elements in the array are random, I will not know which element # DAY is (ie it's not as simple as... (3 Replies)
Hi,
My doubt is how to access array elements..
Situation is as below:
#!/bin/ksh
set -x
typeset -i x=0
typeset -i y=0
typeset -i BID=0
typeset -i count=0
while ] ; do
x=`expr $x + 1`;
hwmgr show scsi > scsi.tmp
while read line; do
set... (1 Reply)
How can I get my array to understand the double-quotes I'm passing into it are to separate text strings and not part of an element? here's what I'm working with...
db2 -v connect to foo
db2 -x "select '\"' || stats_command || '\",' from db2law1.parallel_runstats where tabname = 'BAZ'"
set... (4 Replies)
Hi,
I have an array containing following sample information
@array = qw (chr02 chr02 chr02 chr02 chr02 chr03 chr03 chr04 chr04 chr05 chr05 chr05 chr07 chr07) I need to replace all duplicate entries by an underscore to get the following output@array = qw (chr02 _ _ _ _ chr03 _ chr04 _ chr05 _ _... (4 Replies)
Is there a way to print multiple array elements without iterating through the array using bash?
Can you do something like...
echo ${array}and get all those separate elements from the array? (2 Replies)
Hi,
I can't find out how to create correct code to get multiplication of each elements of array. Let's say I enter array into command line (2 3 4 5 6 8) and i need output 2*3*4*5*6*8=5760.
I tried this one, but answer is 0.
for i in $@; do
mult=$((mult*i))done
echo "mult: " $mult
... (4 Replies)
Hi everyone, :)
I'm trying to make a simple C program that scans an array of chars to see if its elements are similar.
I can't understand what's wrong. Could you help me to fix this? Here is the code.
Thanks!
#include<stdio.h>
int main() {
int arr;
int i, len;
int flag =... (10 Replies)
Hi
I wanted to print random elements from an array at bash shell
I use the following code, but I always see first element getting printed
#!/bin/bash
c=1
expressions=(pink red white yellow purple)
while ]; do
echo "The value of RANDOM is $RANDOM"
selectedexpression=${expressions}]};... (5 Replies)
Hi All,
need help with reading the array and sum of the array elements.
given an array of integers of size N . You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large.
Input Format
The first line of the input consists of an... (1 Reply)
I have an array code and output is below:
echo $1
while read -r fline; do
echo "%%%%%%$fline%%%%%"
fmy_array+=("$fline")
done <<< "$1"
Output:
CR30903 YU0007 SRIL CR30903 Yogesh SRIL
%%%%%%CR30903 YU0007 SRIL%%%%%
%%%%%%CR30903 Yogesh SRIL%%%%%
... (8 Replies)
Discussion started by: mohtashims
8 Replies
LEARN ABOUT CENTOS
font::ttf::segarr
Font::TTF::Segarr(3) User Contributed Perl Documentation Font::TTF::Segarr(3)NAME
Font::TTF::Segarr - Segmented array
DESCRIPTION
Holds data either directly or indirectly as a series of arrays. This class looks after the set of arrays and masks the individual sub-
arrays, thus saving a class, we hope.
INSTANCE VARIABLES
All instance variables do not start with a space.
The segmented array is simply an array of segments
Each segment is a more complex affair:
START
In terms of the array, the address for the 0th element in this segment.
LEN Number of elements in this segment
VAL The array which contains the elements
METHODS
Font::TTF::Segarr->new($size)
Creates a new segmented array with a given data size
$s->fastadd_segment($start, $is_sparse, @dat)
Creates a new segment and adds it to the array assuming no overlap between the new segment and any others in the array. $is_sparse
indicates whether the passed in array contains "undef"s or not. If false no checking is done (which is faster, but riskier). If equal to 2
then 0 is considered undef as well.
Returns the number of segments inserted.
$s->add_segment($start, $overwrite, @dat)
Creates a new segment and adds it to the array allowing for possible overlaps between the new segment and the existing ones. In the case of
overlaps, elements from the new segment are deleted unless $overwrite is set in which case the elements already there are over-written.
This method also checks the data coming in to see if it is sparse (i.e. contains undef values). Gaps cause new segments to be created or
not to over-write existing values.
$s->tidy
Merges any immediately adjacent segments
$s->at($addr, [$len])
Looks up the data held at the given address by locating the appropriate segment etc. If $len > 1 then returns an array of values, spaces
being filled with undef.
$s->remove($addr, [$len])
Removes the item or items from addr returning them as an array or the first value in a scalar context. This is very like "at", including
padding with undef, but it deletes stuff as it goes.
$s->copy
Deep copies this array
$s->copy_seg($seg)
Creates a deep copy of a segment
BUGS
No known bugs.
AUTHOR
Martin Hosken Martin_Hosken@sil.org. See Font::TTF::Font for copyright and licensing.
perl v5.16.3 2011-10-13 Font::TTF::Segarr(3)