Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to compare two columns in a single file in unix

Tags:

bash

unix

My req is i need to get the output if the two columns are not equal below is my code.

The output is as below here my req is for example the first shouldnt be printed as both are equal the second should be printed as both are not equal.

cat testingfull.txt|sed -n '/"Exp_CDL_BOOKINGS_F"/,/TABLEATTRIBUTE NAME/p'|grep EXPRESSION | awk -F"\"" '{print $8,"=",$12}'

BOOK_DATE_KEY=BOOK_DATE_KEY
Lkp_BOOKINGS_FACT_KEY=iif( not  isnull(i_BOOKINGS_FACT_KEY) and isnull(iif(BOOK_DATE_KEY<>Lkp_BOOK_DATE_KEY, NULL)),null,i_BOOKINGS_FACT_KEY)
BOOKINGS_FACT_KEY=Lkp_BOOKINGS_FACT_KEY
like image 410
Tejesh Chilla Avatar asked Oct 15 '13 09:10

Tejesh Chilla


People also ask

Which command is used to compare two files Unix?

cmp command in Linux/UNIX is used to compare the two files byte by byte and helps you to find out whether the two files are identical or not.


1 Answers

Compare columns in your awk command:

awk -F'"' '$8!=$12 {print $8,"=",$12}'
like image 61
anubhava Avatar answered Oct 24 '22 20:10

anubhava