Sponsored Content
Top Forums Shell Programming and Scripting Perl script to verify that a value is present in an array (list) Post 302830497 by Don Cragun on Tuesday 9th of July 2013 03:54:35 AM
Old 07-09-2013
And what are you expecting the output to be when you compare these two files?

If the same data appears multiple times (e.g., 25 apears twice in the 4th field of both files), does it matter if they appear the same number of times or only that the given value is present at least once? (Of course, this assumes that colon and semicolon are subfield separators in the 4th vertical bar separated field. You need to explicitly state what your field separators are since there are clearly other possibilities with the minimal sample you have shown us!)

How about showing us an example where some fields do not match and show us the desired output.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Perl] Accessing array elements within a sed command in Perl script

I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows: $count = 0; while ( $count < $#test ) { `sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`; `cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies

2. Shell Programming and Scripting

How to check the variable is present in array or not ?

Hi , I am trying to check wether the variable is present in the array. please see the below code .when ever i do this its taking only the first value of the array . please advise. ###Code Snnipet ### #!/bin/ksh set -xv if ]; then echo " you have Specified the ORG ID - $1 " ... (1 Reply)
Discussion started by: padhu.47
1 Replies

3. Shell Programming and Scripting

How to run a loop for assigning strings which are present in a file to an array

Hi Forum, I am struggling with the for loop in shell script. Let me explain what is needed in the script. I have a file which will conatin some strings like file1 place1 place2 place3 checkpoint some other text some more text Now what my requirement is the words ... (2 Replies)
Discussion started by: siri_14
2 Replies

4. Shell Programming and Scripting

How to export an array to perl script?

hi all...... i want to use an array ,declared in bash, in embedded perl script. is there any way to export whole array so that i can use it '$ENV{}' or something.. thanx in advance!! regards, prayush (1 Reply)
Discussion started by: tprayush
1 Replies

5. Shell Programming and Scripting

How to get list of user into an array in perl script

Hi, cut -d: -f1,3 /etc/group >rpt.out I have a doubt in perl. right i am getting list of group user id into rpt.out file. instead i need to store it as an array in perl script. could you please tell me how can i get list of user into an array in perl script.. thanks in advance. (1 Reply)
Discussion started by: solo123
1 Replies

6. Shell Programming and Scripting

Script to list files not present in audio.txt file

I am having following folder structure. /root/audios/pop /root/audios/jazz /root/audios/rock Inside those pop, jazz, rock folders there are following files, p1.ul, p2.ul, p3.ul, j1.ul, j2.ul, j3.ul, r1.ul, r2.ul, r3.ul And I have a file named as "audio.txt" in the path /root/audios,... (11 Replies)
Discussion started by: gopikrish81
11 Replies

7. Shell Programming and Scripting

HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

Hi all, Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM. Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers. At the moment am... (3 Replies)
Discussion started by: newbie_01
3 Replies

8. Shell Programming and Scripting

calling a shell script present on another server using perl script.

Hi, I am working on a sever A. I want to write a perl script to execute a shell script persent on the server B. please help me in this. thanks in advance. (3 Replies)
Discussion started by: anandgodse
3 Replies

9. UNIX for Advanced & Expert Users

Help in perl script Array.

hi Team, i need a help in perl , i need to get values(10 rows +) from perl GUI and insert those values into oracle table. am trying to achive this in Perl array, can you please help me on this. thanks senthil (1 Reply)
Discussion started by: senkerth
1 Replies

10. Shell Programming and Scripting

Perl next if @array (exclude a list of values)

I'm trying to exlude a list of values with perl to process while reading in a file. Is there a way to use the next if with a list? Example: @array = qw(val1 val2 val3 val6); while (<>) { next if $_ =~ @array; # values I don't want to process here print; # process the rest here }... (8 Replies)
Discussion started by: timj123
8 Replies
NS(3N)																	    NS(3N)

NAME
ns_addr, ns_ntoa - Xerox NS(tm) address conversion routines SYNOPSIS
#include <sys/types.h> #include <netns/ns.h> struct ns_addr ns_addr(cp) char *cp; char *ns_ntoa(ns) struct ns_addr ns; DESCRIPTION
The routine ns_addr interprets character strings representing XNS addresses, returning binary information suitable for use in system calls. ns_ntoa takes XNS addresses and returns ASCII strings representing the address in a notation in common use in the Xerox Development Envi- ronment: <network number>.<host number>.<port number> Trailing zero fields are suppressed, and each number is printed in hexadecimal, in a format suitable for input to ns_addr. Any fields lacking super-decimal digits will have a trailing ``H'' appended. Unfortunately, no universal standard exists for representing XNS addresses. An effort has been made to insure that ns_addr be compatible with most formats in common use. It will first separate an address into 1 to 3 fields using a single delimiter chosen from period (``.''), colon (``:'') or pound-sign (``#''). Each field is then examined for byte separators (colon or period). If there are byte separators, each subfield separated is taken to be a small hexadecimal number, and the entirety is taken as a network-byte-ordered quantity to be zero extended in the high-network-order bytes. Next, the field is inspected for hyphens, in which case the field is assumed to be a number in decimal notation with hyphens separating the millenia. Next, the field is assumed to be a number: It is interpreted as hexadecimal if there is a leading ``0x'' (as in C), a trailing ``H'' (as in Mesa), or there are any super-decimal digits present. It is interpreted as octal is there is a leading ``0'' and there are no super-octal digits. Otherwise, it is converted as a decimal number. SEE ALSO
hosts(5), networks(5), DIAGNOSTICS
None (see BUGS). BUGS
The string returned by ns_ntoa resides in a static memory area. ns_addr should diagnose improperly formed input, and there should be an unambiguous way to recognize this. 4.3 Berkeley Distribution May 12, 1986 NS(3N)
All times are GMT -4. The time now is 01:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy