Sponsored Content
Top Forums Shell Programming and Scripting Compare two files using awk command recursively Post 302899319 by Ragu14 on Monday 28th of April 2014 12:51:49 PM
Old 04-28-2014
File 1:

Code:
C:\script>call transaction 1OPOP

C:\script>Select ID, PO_ID, TIME, DES From Table
ID            PO_NUM            TIME                    DES            
-------        ------------    ---------------                -----
11232323    1OPOP            2012-08-01-23.02.50.040000    SAMPLE    
11232324    1OPOP            2013-09-01-23.02.50.040000    SAMPLE    
11232325    1OPOP            2014-09-01-23.02.50.040000    SAMPLE    
11232326    1OPOP            2015-09-01-23.02.50.040000    SAMPLE
4 record(s) selected.
    
C:\script>call transaction 1XDXD

C:\script>Select ID, PO_ID, TIME, DES From Table
ID            PO_NUM            TIME                    DES            
-------        ------------    ---------------                -----
11232323    1XDXD            2012-07-01-23.02.50.040000    SAMPLE    
11232324    1XDXD            2013-09-01-23.02.50.040000    SAMPLE    
11232325    1XDXD            2014-08-01-23.02.50.040000    SAMPLE    
3 record(s) selected.

C:\script>call transaction 1IOIO

C:\script>Select ID, PO_ID, TIME, DES From Table
ID            PO_NUM            TIME                    DES            
-------        ------------    ---------------                -----
11232323    1IOIO            2011-06-01-23.02.50.040000    SAMPLE    
11232324    1IOIO            2012-09-01-23.02.50.040000    SAMPLE    
2 record(s) selected.

File 2:
Code:
C:\script>call transaction 1OPOP

C:\script>Select ID, PO_ID, TIME, DES From Table
ID            PO_NUM            TIME                        DES            
-------        ------------    ---------------                -----
11232323    1OPOP            2012-09-01-23.02.50.040000    SAMPLE    
11232324    1OPOP            2013-09-01-23.02.50.040000    SAMPLE    
11232325    1OPOP            2014-09-01-23.02.50.040000    SAMPLE    
11232326    1OPOP            2015-09-01-23.02.50.040000    SAMPLE
4 record(s) selected.
    
C:\script>call transaction 1XDXD

C:\script>Select ID, PO_ID, TIME, DES From Table
ID            PO_NUM            TIME                        DES            
-------        ------------    ---------------                -----
11232323    1XDXD            2012-08-01-23.02.50.040000    SAMPLE    
11232324    1XDXD            2013-09-01-23.02.50.040000    SAMPLE    
11232325    1XDXD            2014-08-01-23.02.50.040000    SAMPLE    
3 record(s) selected.

C:\script>call transaction 1IOIO

C:\script>Select ID, PO_ID, TIME, DES From Table
ID            PO_NUM            TIME                        DES            
-------        ------------    ---------------                -----
11232323    1IOIO            2011-05-01-23.02.50.040000    SAMPLE    
11232324    1IOIO            2012-09-01-23.02.50.040000    SAMPLE    
2 record(s) selected.

First Program will start comparing File1's Red text against File2's Red Text,
File1's Red text is greater than File'2 Red text. So no need to do anything.
Then
Program will start comparing File1's Blue text Against File2's Blue Text.
File1's Blue text is greater than File'2 Blue text. So no need to do anything.
Then
Program will start comparing File1's GREEN text Against File2's GREEN Text. Here File1's GREEN text is lesser than File'2 GREEN text. So Print PO_NUM 1IOIO (Which is in orange Color).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk compare 2 files

Hi i hope some awk gurus here can help me.. here is what i need i have 2 files: File1 152445 516532 405088.pdf 152445 516533 405089.pdf 152491 516668 405153.jpg 152491 520977 408779.jpg 152491 0 409265.pdf File2 516532 /tmp/MainStreet_Sum09_Front_FNL.pdf 516533... (9 Replies)
Discussion started by: kenray
9 Replies

2. Shell Programming and Scripting

using awk to compare two files

Hi, I have two tab separated files; file1: S.No ddi fi cu o/l t+ t- 1 0.5 0.6 o 0.1 0.2 2 0.2 0.3 l 0.3 0.4 3 0.5 0.8 l 0.1 0.6 file2: S.No ddi fi cu o/l t+ t- 1 0.8 0.9 o 0.5 0.6 2 0.5 0.2 o 0 0 3 0.2 0.3 l 0 0 4 0.5 0.6 l 0 0 (1 Reply)
Discussion started by: vasanth.vadalur
1 Replies

3. Shell Programming and Scripting

Require compare command to compare 4 files

I have four files, I need to compare these files together. As such i know "sdiff and comm" commands but these commands compare 2 files together. If I use sdiff command then i have to compare each file with other which will increase the codes. Please suggest if you know some commands whcih can... (6 Replies)
Discussion started by: nehashine
6 Replies

4. Shell Programming and Scripting

Compare two files with awk

Hello, I have a script which extracts the values from a csv file when a specific date is entered : #!/bin/sh awk 'BEGIN{printf("Entrez la date : "); getline date < "-"} $0 ~ date {f=1;print;next} /^{2}\//{f=0} f' file1.csv This script gives me a number of lines with different values. ... (6 Replies)
Discussion started by: freyr
6 Replies

5. Shell Programming and Scripting

awk command to compare a file with set of files in a directory using 'awk'

Hi, I have a situation to compare one file, say file1.txt with a set of files in directory.The directory contains more than 100 files. To be more precise, the requirement is to compare the first field of file1.txt with the first field in all the files in the directory.The files in the... (10 Replies)
Discussion started by: anandek
10 Replies

6. Shell Programming and Scripting

Script to compare files recursively using sdiff

Hi All, I have been surfing to get some idea on how to compare same files from two different paths. one path will have oldfiles directory and another path will have newfiles directory. Each main directories will have sub-directories in them and each sub-directories inturn will have... (3 Replies)
Discussion started by: Optimus81
3 Replies

7. Shell Programming and Scripting

awk compare files

I have a below requirement and trying to compare the files using awk File 1 - Already stored on a prev day id | text | email id --------------------------------- 89564|this is line 1 | xyz@sample.txt 985384|this is line 2 | abc@sample.txt 657342|this is line 3 |... (3 Replies)
Discussion started by: rakesh_411
3 Replies

8. UNIX for Dummies Questions & Answers

awk command to compare files by column

So I have this issue. I have 4 files. the first one is the master file who has all possible combinations: file 1 - a - b - c - d - e the other three have some of the letters and a number instead of - for example file 2 34 a 5 c file 3 10 b 12 ... (3 Replies)
Discussion started by: Quijotes
3 Replies

9. Shell Programming and Scripting

[awk] Compare two files

HI!! I am trying to compare two files using AWK but I have some problems. I need to count how many times letters are used in two texts. This is my script { long=length($0) for (i=1;i<=long;i++) { aux=substr($0,i,1) if ( aux != " " && aux != "" ) ... (7 Replies)
Discussion started by: ettore8888
7 Replies

10. Shell Programming and Scripting

Simple awk command to compare two files and print first difference

Hello, I have two text files, each with a single column, file 1: 124152970 123899868 123476854 54258288 123117283 file 2: 124152970 123899868 54258288 123117283 122108330 (5 Replies)
Discussion started by: LMHmedchem
5 Replies
load_sample(3alleg4)						  Allegro manual					      load_sample(3alleg4)

NAME
load_sample - Loads a sample from a file. Allegro game programming library. SYNOPSIS
#include <allegro.h> SAMPLE *load_sample(const char *filename); DESCRIPTION
Loads a sample from a file, supporting both mono and stereo WAV and mono VOC files, in 8 or 16-bit formats, as well as formats handled by functions registered using register_sample_file_type(). Example: SAMPLE *sample = load_sample(user_input); if (!sample) abort_on_error("Couldn't load sample!"); RETURN VALUE
Returns a pointer to the SAMPLE or NULL on error. Remember to free this sample later to avoid memory leaks. SEE ALSO
destroy_sample(3alleg4), load_voc(3alleg4), load_wav(3alleg4), play_sample(3alleg4), save_sample(3alleg4), register_sam- ple_file_type(3alleg4), exsample(3alleg4) Allegro version 4.4.2 load_sample(3alleg4)
All times are GMT -4. The time now is 02:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy