Sponsored Content
Top Forums Shell Programming and Scripting Remove an element from an array in PERL Post 302202135 by Yogesh Sawant on Wednesday 4th of June 2008 07:01:16 AM
Old 06-04-2008
you can remove an element of an array using splice function
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

accessing my first element of array

Hello everyonel, I have an array set like so num=4 read name arr=name I go through while loop to assign different values to different array element from 1 to 4. when I try to access the FIRST element of the array I get the last one first. Like if I say ${arr} it will show the last element... (4 Replies)
Discussion started by: afadaghi
4 Replies

2. Shell Programming and Scripting

Perl delete an element from array

Probably I am not seeing it or I am not using the "delete" correctly I had the following codes but it does not work for me #!/bin/perl -w ... @sysFile1 = (a_b, a_c, a_d); @sysFile2 = (a_c, a_e, b_f); foreach $line1 (@sysFile1){ trim(\$line1); (my $tmp1, my $tmp2) = split/_/,... (6 Replies)
Discussion started by: ahtat99
6 Replies

3. Shell Programming and Scripting

Shift array element

I want to delete and 0th element of array in shell scrpit and also shift all others to one level up. (2 Replies)
Discussion started by: darshakraut
2 Replies

4. Shell Programming and Scripting

remove an element from array

I need to remove an element from the below array variable TABLENAME. #!/bin/ksh set -A TABLENAME "mirf roxar keke mirs" echo "the array is ${TABLENAME}" If i need to remove say keke and have the final TABLENAME as below, how this could be achieved. Pls throw some light. echo "Modified... (3 Replies)
Discussion started by: michaelrozar17
3 Replies

5. Shell Programming and Scripting

Perl: One action if an element doesn't exist in array

Hello, I want to run one (not multiple) action if an element doesn't exist in array. for example: @array = (1..10); foreach $el (@array) { if ($el != 11) { print "number not found\n"; } } the output of this simple script: number not found (3 Replies)
Discussion started by: ahmed_zaher
3 Replies

6. Shell Programming and Scripting

previous element in the array perl

Hi, How to get previous/next element in the array perl Example @queue = (1, 2 ,3 , 4); I want to get value of 1 and 2, or, 2 and 3, or 3 and 4...etc and compare to value which one is greater to do that I need to get previous and next element of array ? (1 Reply)
Discussion started by: guidely
1 Replies

7. Shell Programming and Scripting

Multiplying array element

I am trying to take all the elements of an array and multiply them by 2, and then copy them to a new array. Here is what I have i=0 for true in DMGLIST do let DMGSIZES2="${DMGSIZES}"*2 let i++ done unset i echo ${DMGSIZES2} It does the calculation correctly for the first element,... (7 Replies)
Discussion started by: nextyoyoma
7 Replies

8. Shell Programming and Scripting

Perl: How to check whether my array contains element x

Hi All, I am new to perl I am stuck in simple problem I need your help I want to define a subroutine. sub check_if_entity_exists(@array_to_be_checked,$entityName) I have array as http-listener-1 http-listener-2 http-listener-3 http-listener-4 If i send http-listener-3 my... (1 Reply)
Discussion started by: javaholics
1 Replies

9. Shell Programming and Scripting

Need to remove first 6 lines and last line in a array ---- perl scripting

Hi I have stored a command output in an array like below @a = `xyz`; actually xyz comnad will give the output like this tracker date xxxxxxx xxxxxxx --------------------- 1 a 2 b ---------------------- i have stored the "xyz" output to an... (3 Replies)
Discussion started by: siva kumar
3 Replies

10. UNIX for Advanced & Expert Users

Array Element

This question is for someone that's more familiar with Array Element. I need to know if the maximum array element that can be assigned is 1024 and if its so, Is there a workaround solution when the counter exceeded 1024? param_array="$param_nam" counter=$counter+1 #to avoid space... (3 Replies)
Discussion started by: cumeh1624
3 Replies
VMSPLICE(2)						     Linux Programmer's Manual						       VMSPLICE(2)

NAME
vmsplice - splice user pages into a pipe SYNOPSIS
#define _GNU_SOURCE #include <fcntl.h> #include <sys/uio.h> ssize_t vmsplice(int fd, const struct iovec *iov, unsigned long nr_segs, unsigned int flags); DESCRIPTION
The vmsplice() system call maps nr_segs ranges of user memory described by iov into a pipe. The file descriptor fd must refer to a pipe. The pointer iov points to an array of iovec structures as defined in <sys/uio.h>: struct iovec { void *iov_base; /* Starting address */ size_t iov_len; /* Number of bytes */ }; The flags argument is a bit mask that is composed by ORing together zero or more of the following values: SPLICE_F_MOVE Unused for vmsplice(); see splice(2). SPLICE_F_NONBLOCK Do not block on I/O; see splice(2) for further details. SPLICE_F_MORE Currently has no effect for vmsplice(), but may be implemented in the future; see splice(2). SPLICE_F_GIFT The user pages are a gift to the kernel. The application may not modify this memory ever, or page cache and on-disk data may differ. Gifting pages to the kernel means that a subsequent splice(2) SPLICE_F_MOVE can successfully move the pages; if this flag is not specified, then a subsequent splice(2) SPLICE_F_MOVE must copy the pages. Data must also be properly page aligned, both in memory and length. RETURN VALUE
Upon successful completion, vmsplice() returns the number of bytes transferred to the pipe. On error, vmsplice() returns -1 and errno is set to indicate the error. ERRORS
EBADF fd either not valid, or doesn't refer to a pipe. EINVAL nr_segs is 0 or greater than IOV_MAX; or memory not aligned if SPLICE_F_GIFT set. ENOMEM Out of memory. VERSIONS
The vmsplice() system call first appeared in Linux 2.6.17. CONFORMING TO
This system call is Linux-specific. NOTES
vmsplice() follows the other vectorized read/write type functions when it comes to limitations on number of segments being passed in. This limit is IOV_MAX as defined in <limits.h>. At the time of this writing, that limit is 1024. SEE ALSO
splice(2), tee(2), feature_test_macros(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2009-09-15 VMSPLICE(2)
All times are GMT -4. The time now is 12:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy