LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Compare 1 column bash (https://www.linuxquestions.org/questions/programming-9/compare-1-column-bash-898008/)

alancampbell6 08-18-2011 03:35 AM

Compare 1 column bash
 
I generate a file everyday with three columns. I want my script to compare today's file with yesterdays file. It works currently but not the way i want it.the second and third column change every day but i dont want to know about that, i only want to know if the first column changes.

Here is the code that compares all columns and outputs the differences to a txt file.

grep -Fxvf $yesterday.txt $today.txt >> diff.txt

Does anyone know how to only compare the first column only??

grail 08-18-2011 04:11 AM

Have you looked at diff or comm?

alancampbell6 08-18-2011 04:16 AM

Yes but i grep was easier for this initially, now maybe diff would be better. any ideas?

grail 08-18-2011 06:19 AM

Have a look at the man pages and see what you find :)


All times are GMT -5. The time now is 02:14 PM.