Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Comparing lists.. Arrays maybe? Post 302529243 by Aussiemick on Wednesday 8th of June 2011 10:49:38 PM
Old 06-08-2011
Comparing lists.. Arrays maybe?

Problem
Part 1.
Gather data from linux server and output to a file named data_DDMMYY
Output file must contain the file name and size

Part 2.
Compare todays data_DDMMYY to yesterdays data_DDMMYY and output results to a file named difference_DDMMYY
Output file must show the difference in size between same named files and identify new and deleted files

Solution
Part 1.
Log into linux, use command "find . -daystart -ctime 0 -type f | xargs ls -sSh > data_DDMMYY" thankyou Yazu
Sample output:
Comparing lists.. Arrays maybe?-example_filepng

Part 2.
Perhaps use of an array and iterator? (my knowledge is very limited when it comes to arrays and iterators)

Idea
Grab file 1, go to line 1, read first string and save to variable x, read second string and save to list2
Grab file 2, using the current line in list2, look for a match.

If a match is found, go to that line, read first string and save to variable y
calculate difference of x-y and save to list1, output first line of list 1 and list 2 to difference_DDMMYY

If match is not found, output <string>.notFound to a new line in difference_DDMMYY


Grab file 1, go to line 2, read first string and save to x, read second string and save to new line in list 2
etc ... until all lines in file 1 have been used.

Then somehow I'd like to find the lines in file 2 that weren't copied to a list and output them to the difference_DDMMYY
as <String>.newFile
I'm sure there's some sort of for loop I can use to solve this, but as of right now I'm stumped and need ideas >.<
Any and all help is appreciated.
Comparing lists.. Arrays maybe?-example_filepng
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comparing Arrays?

Is there anyway that I can compare two Arrays to see if any new strings have been added in them? eg: Array 1: Joe Bob Jane Array 2: Joe Bob Jane Greg It would then output a new array with the changes: Array 3: Greg I'm not very good at shell scripting, and my google and forum searches... (4 Replies)
Discussion started by: blckleprd
4 Replies

2. Shell Programming and Scripting

comparing two arrays or strings in bash

Hi there, im having issue with comparing two variables, in a bash script. im trying to do the following: - get a word from user 1 - split the word into array - get a character from user2 trying to compare the character entered by user 2 with every single character in the array... (2 Replies)
Discussion started by: new2Linux
2 Replies

3. Shell Programming and Scripting

Comparing arrays in perl

Hi all, I am trying to compare two arrays in perl using the following code. foreach $item (@arrayA){ push(@arrayC, $item) unless grep(/$item/, @arrayB); ... (1 Reply)
Discussion started by: chriss_58
1 Replies

4. Shell Programming and Scripting

PERL: simple comparing arrays question

Hi there, i have been trying different methods and i wonder if somebody could explain to me how i would perform a comparison on two arrays for example my @array1 = ("gary" ,"peter", "paul"); my @array2 = ("gary" ,"peter", "joe"); I have two arrays above, and i want to something like this... (5 Replies)
Discussion started by: hcclnoodles
5 Replies

5. Shell Programming and Scripting

Shell Script to Create non-duplicate lists from two lists

File_A contains Strings: a b c d File_B contains Strings: a c z Need to have script written in either sh or ksh. Derive resultant files (File_New_A and File_New_B) from lists File_A and File_B where string elements in File_New_A and File_New_B are listed below. Resultant... (7 Replies)
Discussion started by: mlv_99
7 Replies

6. UNIX for Dummies Questions & Answers

File Field Replacement, Assigning Fields to Variables, Lists/Arrays?

Okay, I've made threads on extracting fields and comparing strings in separate files in .csv's. I've written the following code with intentions of learning more. I just want this one question answered: How can I assign fields from a file(comma separated) to variables? My goal is to check... (0 Replies)
Discussion started by: chickeneaterguy
0 Replies

7. Shell Programming and Scripting

Comparing 2 arrays but ignoring certain patterns

I'm trying to compare 2 array and print the difference at a 3rd file. However how am i going to compare this 2 arrays by ignoring certain patterns: For example: 1st array contains: ctahci cptcsa0 ctsata:25:seed cptcsa1:50:seed ctsata_1:25:seed 2nd array contains: cptcsa0 ctsata... (0 Replies)
Discussion started by: hongping
0 Replies

8. UNIX for Dummies Questions & Answers

Comparing lists when "diff" isn't sufficiently stringent

Greetings. I like to compare two lists of numbers, A.txt and B.txt, to see the numbers that are in B.txt but not in A.txt. I only need the "deletions" with reference to A.txt. Using the diff command doesn't work because it considers too many of the deletions just changes because they are a... (7 Replies)
Discussion started by: Twinklefingers
7 Replies

9. Shell Programming and Scripting

awk arrays comparing multiple columns across two files.

Hi, I'm trying to use awk arrays to compare values across two files based on multiple columns. I've attempted to load file 2 into an array and compare with values in file 1, but success has been absent. If anyone has any suggestions (and I'm not even sure if my script so far is on the right lines)... (4 Replies)
Discussion started by: hubleo
4 Replies

10. Shell Programming and Scripting

Comparing multiple network files (edge lists)

I want to compare 4 edge-lists to basically see if an edge is present in all 4 networks. The issue is that an edge A-B in one file can be present as B-A in another file. Example: Input 1: net1.txt A B 0.1 C D 0.65 D E 0.9 E A 0.7 Input 2: net2.txt A Z 0.1 C D 0.65 E D 0.9 E A... (1 Reply)
Discussion started by: Sanchari
1 Replies
GLARRAYELEMENT(3G)														GLARRAYELEMENT(3G)

NAME
glArrayElement - render a vertex using the specified vertex array element C SPECIFICATION
void glArrayElement( GLint i ) PARAMETERS
i Specifies an index into the enabled vertex data arrays. DESCRIPTION
glArrayElement commands are used within glBegin/glEnd pairs to specify vertex and attribute data for point, line, and polygon primitives. If GL_VERTEX_ARRAY is enabled when glArrayElement is called, a single vertex is drawn, using vertex and attribute data taken from location i of the enabled arrays. If GL_VERTEX_ARRAY is not enabled, no drawing occurs but the attributes corresponding to the enabled arrays are modified. Use glArrayElement to construct primitives by indexing vertex data, rather than by streaming through arrays of data in first-to-last order. Because each call specifies only a single vertex, it is possible to explicitly specify per-primitive attributes such as a single normal per individual triangle. Changes made to array data between the execution of glBegin and the corresponding execution of glEnd may affect calls to glArrayElement that are made within the same glBegin/glEnd period in non-sequential ways. That is, a call to glArrayElement that precedes a change to array data may access the changed data, and a call that follows a change to array data may access original data. NOTES
glArrayElement is available only if the GL version is 1.1 or greater. glArrayElement is included in display lists. If glArrayElement is entered into a display list, the necessary array data (determined by the array pointers and enables) is also entered into the display list. Because the array pointers and enables are client-side state, their val- ues affect display lists when the lists are created, not when the lists are executed. SEE ALSO
glClientActiveTextureARB(3G), glColorPointer(3G), glDrawArrays(3G), glEdgeFlagPointer(3G), glGetPointerv(3G), glIndexPointer(3G), glInterleavedArrays(3G), glNormalPointer(3G), glTexCoordPointer(3G), glVertexPointer(3G) GLARRAYELEMENT(3G)
All times are GMT -4. The time now is 08:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy