Bash script to compare 2 file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash script to compare 2 file
# 1  
Old 03-06-2015
Bash script to compare 2 file

Hello Friends

please help me to create script to compare 2 fiile which has rpm info .

File 1:
Code:
glibc-2.12.1.149.el6_6.5.x86_64.rpm
glibc-common-2.12-1.149.el6_6.5.x86_64.rpm

File 2 :
Code:
glibc-2.12.123.el6_6.5.x86_64.rpm
glibc-common-2.12-123.el6_6.5.x86_64.rpm

To compare file1 data is grater then file2 or not.
please help.

Thanks in advance .!
# 2  
Old 03-06-2015
Hi.

On a system:
Code:
OS, ker|rel, machine: Linux, 2.6.32-358.23.2.el6.centos.plus.x86_64, x86_64
Distribution        : CentOS 6.4 (Final)

In package: rpmdevtools.noarch there is a code rpmdev-vercmp RPM version comparison checker which looks useful. (A result from How to programmatically determine the highest version kernel RPM installed? - Unix & Linux Stack Exchange as the first hit in a Google search compare versions of rpm files)

Best wishes ... cheers, drl
This User Gave Thanks to drl For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Compare date bash script

I all I have written a bash script for compare two date. One of those is a result of query, and another is current date. I have a problem with the format, because the first is 09/12/19 18:50:30 but for having this result I have to do d1DB=$(date -d "$valData" +'%m/%d/%y %T') and the second... (9 Replies)
Discussion started by: rdie77
9 Replies

2. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

3. UNIX for Beginners Questions & Answers

Bash script to compare file all the files exits or not

Currently i am building a script like based on region parameter it will filter the records in config file and then it will create a text file like ab.txt and it will read the path location in that file and now i need to compare the files name in the config file to files in the path of the config... (1 Reply)
Discussion started by: saranath
1 Replies

4. Shell Programming and Scripting

Array compare bash script

Hello, i have a script that should compare between ${ARRAY} that contains all fstab record like this : >>echo ${ARRAY} / /boot between all mountpoints in my df that is stord in ${ARRAY2} >>echo ${ARRAY2} / /boot /dev/shm /var/spool/asterisk/monitor now i have this loop: for i in... (6 Replies)
Discussion started by: batchenr
6 Replies

5. Shell Programming and Scripting

Bash compare a list of file

Dear all, I believe this is a Bash basic question... I am bit ashamed for asking actually... I want to create a Bash script that compares 2 different folders: 1) work_folder and 2) work_folder.git #!/bin/bash FOLDER_NAME=`pwd | awk -F/ '{ print $NF }' | awk -F. '{ print $1 }'` ... (6 Replies)
Discussion started by: freddie50
6 Replies

6. Shell Programming and Scripting

Compare & Copy Directories : Bash Script Help

Beginner/Intermediate shell; comfortable in the command line. I have been looking for a solution to a backup problem. I need to compare Directory 1 to Directory 2 and copy all modified or new files/directories from Directory 1 to Directory 3. I need the directory and file structure to be... (4 Replies)
Discussion started by: Rod
4 Replies

7. Shell Programming and Scripting

Bash script to compare two lists

Hi, I do little bash scripting so sorry for my ignorance. How do I compare if the two variable not match and if they do not match run a command. I was thinking a for loop but then I need another for loop for the 2nd list and I do not think that would work as in the real world there could... (2 Replies)
Discussion started by: GermanJulian
2 Replies

8. Shell Programming and Scripting

How to compare time in bash script?

Hi, Anyone know how to compare the time in bash script? I want to compare say 30 min. to 45 min. ( AIX ) Thanks. (1 Reply)
Discussion started by: sumit30
1 Replies

9. Shell Programming and Scripting

count and compare no of records in bash shell script.

consider this as a csv file. H,0002,0002,20100218,17.25,P,barani D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 T,5 N i want to read the csv file and count the number of rows that start with D and... (11 Replies)
Discussion started by: barani75
11 Replies

10. Shell Programming and Scripting

Use Perl In Bash Script To Compare Floationg Points

Is there a way to compare two floating points numbers in a bash script using perl? I've tried just using a bash if statement and it doesn't seem to support floating point numbers. Can the perl line read vars from bash then output a var to bash? a=1.1 #from bash b=1.5 #from bash if... (3 Replies)
Discussion started by: Grizzly
3 Replies
Login or Register to Ask a Question