LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to compare two columns in a file. (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-compare-two-columns-in-a-file-798568/)

shilpa.godhe 03-29-2010 02:24 AM

How to compare two columns in a file.
 
Hi All,
I am trying to write a script which compares a log file with reference file. The log file has a table, the LHS of the table are constants strings and RHS of table values changes if there are any changes in configuration.

for example.

test.log

SYS_NAME=xyz
SNET_SPEED=3
MODEL_NAME=G2IP5C
SWITCH_TYPE=1
PCI_SLOTS=1.4C,2.EM,3.DC,4.EM,5.VO

test.Ref

SYS_NAME=string
SNET_SPEED=digit
MODEL_NAME=string
SWITCH_TYPE=digit
PCI_SLOTS=string.

Here I am looking for a script which compares test.log file ( whose RHS data-types are known prior whether it is digit or string) with test.Ref which is reference file for test.log file. It will be really helpful for me if any of you give some idea about writing this script.

Thanks,
-Shilpa

PMP 03-29-2010 02:31 AM

What is the output required ?

evo2 03-29-2010 02:42 AM

Does diff not do what you want? eg.

Code:

diff test.log test.Ref
Evo2.


All times are GMT -5. The time now is 03:33 AM.