I have two files, how should i compare these files using shell and awk script

后端 未结 3 1146
清酒与你
清酒与你 2021-01-27 13:17

I have two files

Content of file A

paybackFile_537214-760887_000_20120801.xml
paybackFile_354472-544899_000_20120801.xml
paybackFile_62-11033_000_2012080         


        
3条回答
  •  星月不相逢
    2021-01-27 13:21

    Here's a script:

    #!/bin/sh
    
    FILEA=fileA
    FILEB=fileB
    
    awk -F" " ' { print $2 } ' $FILEA > .tmpfileA 
    awk -F" " ' { print $5 } ' $FILEB | sed 's/\.gpg//' | grep 'decrypted successfully' > .tmpfileB
    
    
    diff .tmpfileA .tmpfileB
    
    rm -f .tmpfileA
    rm -f .tmpfileB
    

    All you'll need to change is the variables FILEA and FILEB

    When executing it with the inputs you provided it gives the following result:

    $ testAB.ksh 
    2d1
    < paybackFile_521000-845442_000_20120701.xml
    $ 
    

提交回复
热议问题