Sponsored Content
Top Forums Shell Programming and Scripting Ksh: how compare content of a file with an other array Post 302913486 by jmartin on Sunday 17th of August 2014 02:57:58 PM
Old 08-17-2014
I was meaning like this
Code:
array[0]="AAAA"
array[1]="BBBB"
array[2]="CCCC"
array[3]="DDDD"

Yes I've tried but I did not found yet a solution.. any help would be great
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

compare array contents with file

I have an array "arrA" with the following contents: A0012 Paint Shop.doc ES001 Contract Signature.doc Budget Plan.pdf TS PWS.pdf My data file "Files.dat" has the same contents: A0012 Paint Shop.doc ES001 Contract Signature.doc Budget Plan.pdf TS PWS.pdf I have a script that compares... (0 Replies)
Discussion started by: orahi001
0 Replies

2. Shell Programming and Scripting

file content in an array PERL

Hello everybody, I'm new in this forum. I searched a long time for a solution for my problem but I didn't find the right thing. I have to read from a file (content is "abngjm" without any other signs) and have to write this content in an array. But every sign has to be called by its own... (5 Replies)
Discussion started by: e_prof
5 Replies

3. Shell Programming and Scripting

KSH to group records in a file and compare it with another file

Hi, I've a file like below: DeptFile.csv DeptID EmpID ------- ------ Dep01 Emp01 Dep01 Emp02 Dep01 Emp03 Dep02 Emp04 Dep02 Emp05 I've another file which has EmpFile.csv EmpID Salary ------ ------ (3 Replies)
Discussion started by: Matrix2682
3 Replies

4. Shell Programming and Scripting

KSH: Compare variable to $1 in an input file

Hello, I am working with KSH on AIX and I have 2 files generated from different sources... as seen below: FILE1 FILE2 AAA AAA@ABS0001C BBB BBB@ABS0003D CCC CCC@ABS0023A DDD DDD@ABC0145D EEE EEE@ABS0090A FFF FFF@ABS0002A GGG GGG@ABC0150D HHH FILE1 is main main data source,... (4 Replies)
Discussion started by: right_coaster
4 Replies

5. Shell Programming and Scripting

Print @array content to a file

Hi, as the title, I have an array @f_lines with gene information in it. How can I put the content of @f_lines into a file so that I can read it? I tried this: open(OUTPUT, "file"); # put gene information in this file; @f_lines = ("gene1", "gene2", "gene3"...); # gene information; print... (3 Replies)
Discussion started by: lyni2ULF
3 Replies

6. Shell Programming and Scripting

Compare file to array, replace with corresponding second array

ok, so here is the issue, I have 2 arrays. I need to be able to create a loop that will find ${ARRAY1 in the text doc, and replace it with ${ARRAY2 then write the results. I already have that working. The problem is, I need it to do that same result across however many items are in the 2... (2 Replies)
Discussion started by: gentlefury
2 Replies

7. Shell Programming and Scripting

File names as array element in ksh

Hi, I have an ksh array(ARR). the elements to the array are file names. i need to go to each file in the array and manipulate the records. for name in ${files}; do ---this loop is for all the file names in the array for i in $(wc -l < $name); do --this loop is for all the records in... (20 Replies)
Discussion started by: usrrenny
20 Replies

8. Shell Programming and Scripting

Compare two folders and file content

Hi, I am having two folders where i need to compare the content of files and also to know if any new files been added and redirect the difference output in respective filename logs. For e.g.: Directory D1: f1 f2 f3 Directory D2: f1 f2 f3 f4 i Need to compare the directories... (25 Replies)
Discussion started by: rohit_shinez
25 Replies

9. Shell Programming and Scripting

Compare & print content of file which is not matching

Hi All I want to compare 2 files using awk and get output of content which is not matching I have 2 files a.txt 123 456 780 143 b.txt A|B|C|167|D|E C|K|D|123|D|E A|B|D|789|G|F C|D|G|143|A|B Not matching line from b.txt O/P A|B|C|167|D|E A|B|D|789|G|F (3 Replies)
Discussion started by: aaysa123
3 Replies

10. Shell Programming and Scripting

ksh scripting SSH to Compare File Sizes

Hello, I currently have very little experience with Shell scripting and trying to create a script for the purpose of collecting the size of a couple sizes on 4 different Hosts. The Idea is to collected the information from the files in which the script is kicked off on, store the values into... (17 Replies)
Discussion started by: Abstract3000
17 Replies
ARRAY_KEYS(3)								 1							     ARRAY_KEYS(3)

array_keys - Return all the keys or a subset of the keys of an array

SYNOPSIS
array array_keys (array $array, [mixed $search_value], [bool $strict = false]) DESCRIPTION
array_keys(3) returns the keys, numeric and string, from the $array. If the optional $search_value is specified, then only the keys for that value are returned. Otherwise, all the keys from the $array are returned. PARAMETERS
o $array - An array containing keys to return. o $search_value - If specified, then only keys containing these values are returned. o $strict - Determines if strict comparison (===) should be used during the search. RETURN VALUES
Returns an array of all the keys in $array. EXAMPLES
Example #1 array_keys(3) example <?php $array = array(0 => 100, "color" => "red"); print_r(array_keys($array)); $array = array("blue", "red", "green", "blue", "blue"); print_r(array_keys($array, "blue")); $array = array("color" => array("blue", "red", "green"), "size" => array("small", "medium", "large")); print_r(array_keys($array)); ?> The above example will output: Array ( [0] => 0 [1] => color ) Array ( [0] => 0 [1] => 3 [2] => 4 ) Array ( [0] => color [1] => size ) SEE ALSO
array_values(3), array_key_exists(3), array_search(3). PHP Documentation Group ARRAY_KEYS(3)
All times are GMT -4. The time now is 11:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy