Sponsored Content
Top Forums Shell Programming and Scripting Compare two outputs/files based on criterias Post 302545745 by tworkemon on Tuesday 9th of August 2011 11:03:39 AM
Old 08-09-2011
Compare two outputs/files based on criterias

Hello,
I currently have a script that outputs to a file that contains the output below. It runs every X minutes. I would like to compare the first run against the second but only output if the minutes column is less than its original or if anything else changes. Thanks for the help.

Original
Code:
http://someurl.com,Name,1 type,16 minutes
http://somurl1.com,Name1,1 type,20 minutes
http://someurl2.com,Name2,1 type,18 minutes
http://someurl3.com,Name3,2 type,16 minutes

New
Code:
http://someurl.com,Name,1 type,30 minutes
http://somurl1.com,Name1,1 type,5 minutes
http://someurl2.com,Name2,2 type,20 minutes
http://someurl3.com,Name3,2 type,5 hours
http://someurl4.com,Name4,2 type,yesterday
http://someurl5.com,Name5,2 type,30 minutes

So it would find and output the format below:

Code:
http://somurl1.com,Name1,1 type,5 minutes
http://someurl2.com,Name2,2 type,20 minutes
http://someurl5.com,Name5,3 type,30 minutes


Last edited by tworkemon; 08-09-2011 at 12:21 PM.. Reason: fix formating
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

compare 2 outputs

Hello, I have a shell script that is used as follows: ./script -s <Oracle_server_name> the script returns several lines in this format: parameter name required value Current Value comments --------------- ------------- -------------- --------- My objective now is to compare 2... (1 Reply)
Discussion started by: melanie_pfefer
1 Replies

2. Shell Programming and Scripting

How to compare 2 files & get only few columns based on a condition related to both files?

Hiiiii friends I have 2 files which contains huge data & few lines of it are as shown below File1: b.dat(which has 21 columns) SSR 1976 8 12 13 10 44.00 39.0700 70.7800 7.0 0 0.00 0 2.78 0.00 0.00 0 0.00 2.78 0 NULL ISC 1976 8 12 22 32 37.39 36.2942 70.7338... (6 Replies)
Discussion started by: reva
6 Replies

3. Shell Programming and Scripting

Compare two files based on integer part only

Please see how can I do this: File A (three columns): X1,Y1,1.01 X2,Y2,2.02 X3,Y3,4.03 File B (three columns): X1,Y1,1 X2,Y2,2 X3,Y3,4.0005 Now I have to compare file A and B based on the integer part of column 3. Means first 2 rows should be OK and the third row should not satisfy... (12 Replies)
Discussion started by: yale_work
12 Replies

4. Shell Programming and Scripting

Compare two files based on values of fields.

Hi All, I have two files and data looks like this: File1 Contents #Field1,Field2 Dist_Center_file1.txt;21 Dist_Center_file3.txt;20 Dist_Center_file2.txt;20 File2 Contents (*** No Header ***) Dist_Center_file1.txt;23 Dist_Center_file2.txt;20 Dist_Center_file3.txt;20 I have... (4 Replies)
Discussion started by: Hangman2
4 Replies

5. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

6. Shell Programming and Scripting

compare 2 files based on columns

Hi Experts, Is there a way to compare 2 files by columns and print matching cases. I have 2 files as below, I want cases where col1 and col2 in f1 matches col1 and col2 in f2 to be printed as output. The separator is space. I want the output to have col1 col2 col 3 from both files printed... (7 Replies)
Discussion started by: novice_man
7 Replies

7. Shell Programming and Scripting

Compare two files, then outputs line number

I have two files, "ranked.txt" and "sorted.txt". Sorted.txt is a smaller subset from ranked.txt that is sorted in alpha order. However ranked.txt preserves the ranking of words I would like to keep. How do I check the rank of every word in sorted.txt when matched to the original ranked.txt? I... (8 Replies)
Discussion started by: pxalpine
8 Replies

8. Shell Programming and Scripting

Compare three files based on two fields

Guys, I tried searching on the internet and I couldn't get the answer for this problem. I have 3 files. First 2 fields of all of them are of same type, say they come from various databases but first two fields in the 3 files means the same. I need to verify the entries that are not present... (4 Replies)
Discussion started by: PikK45
4 Replies

9. Shell Programming and Scripting

Compare files in a folder based on another file

I have a file named file.txt that looks as follows //class1.txt 45 234 67 89 90 //class2.txt 456 34 78 89 120 class1 and class2.txt are the names of files in a folder named folder1. The content of class1.txt file in folder1 67 9 89 5 234 9The content of class2.txt file in... (1 Reply)
Discussion started by: jaff rufus
1 Replies

10. Shell Programming and Scripting

Compare two files based on column

Hi, I have two files roughly 1200 fields in length for each row, sorted on the 2nd field. I need to compare based on that 2nd column between file1 and file2 and print lines that exist in both files into separate files (I can't guarantee that every line in file1 is in file2). Example: File1: ... (1 Reply)
Discussion started by: origon
1 Replies
lpx(8)							      System Manager's Manual							    lpx(8)

Name
       lpx - line printer exerciser

Syntax
       /usr/field/lpx [ -h ] [ -ofile ] [ -pn ] [ -tm ] -ddev

Description
       The line printer exerciser outputs a rolling character pattern to the printer. Five pages are output and then the printer will pause for 15
       minutes (default).  Then 5 more pages are output, followed by a pause.  This pattern continues until the process receives a or a  kill  -15
       pid.

       Disable	the line printer queue of the printer to be tested before running Check the file to determine the line printer queue, and then run
       line printer control program to disable the printer.  This will stop other jobs from interfering with the testing.

Arguments
       You must specify the following function flag and its argument to the exerciser:

       -ddev
	    The line printer device name and unit number to test as listed in the directory.  For example, lp, lp1.

Options
       The options are:

       -h   Prints the help messages for the command.

       -ofile
	    Saves the output diagnostics in file.

       -pn  Sets pause for n minutes.  During the pause period, will only exercise the controller, saving paper.  The default value for n  is  15.
	    A value of n = 0 indicates no pause.

       -tm  Specifies the run time in minutes (m).  The default is to run until the process receives a or kill -15 pid.

Restrictions
       If  there  is  a  need to run a system exerciser over an NFS link or on a diskless system there are some restrictions.  For exercisers that
       need to write into a file system, such as the target file system must be writable by root.  Also the directory, in which any of	the  exer-
       cisers  are  executed,  must be writable by root because temporary files are written into the current directory.  These latter restrictions
       are sometimes difficult to overcome because often NFS file systems are mounted in a way that prevents root from writing into them.  Some of
       the restrictions may be overcome by copying the exerciser to another directory and then executing it.

Examples
       The following example causes to exercise lp1 until the process receives a or kill -15 pid.
       % /usr/field/lpx -dlp1
       The following example exercises lp for 120 minutes in the background.
       % /usr/field/lpx -t120 -dlp &

See Also
       Guide to System Exercisers

																	    lpx(8)
All times are GMT -4. The time now is 06:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy