Find the answer to your Linux question:
Results 1 to 2 of 2
hi readers! my question is: Is it possible to use two awk commands simultaneous for comparision of two values taken from two different files.....???????? for eg: awk '{ if ( ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2004
    Posts
    21

    How can we Compare Values of different files by using AWK..


    hi readers!

    my question is:

    Is it possible to use two awk commands simultaneous for comparision of two values taken from two different files.....????????

    for eg:

    awk '{ if ( $1 ==$1 | awk '{ "%d",$1 } file2 } file1

    i know this syntax is wrong.....but i hope this clears the problem to u all....
    that is comparision of two different values taken from two different files by using awk command....

    hopeing for a quick response...


  2. #2
    Just Joined!
    Join Date
    Sep 2004
    Posts
    7
    I don't know awk that well, but I can show you another method that
    may work for you in the interim.
    Code:
    #!/bin/bash
    
    value1=$(grep STRING FILE1)
    value2=$(grep STRING FILE2)
     
    if [ "$value1" = "value2" ];then
            echo "Hey they are the same!"
    fi
    If you find a way to do it with awk, or another way I'd like to see it.
    Also does anyone know any good Awk tutorials?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •