I'm working on a bash script, with the main objective is to create a .conf file, in which the content is the subtraction of file 2 from file 1.
Example :
File 1
ready serv1 FBgn001bKJ
ready serv2 FBgn003mLo
ready serv3 FBgn002lPx
ready serv4 FBgn000Pas
File 2
ready serv1 FBgn001bKJ
ready serv4 FBgn000Pas
Result
ready serv2 FBgn003mLo
ready serv3 FBgn002lPx
I've tried to use this function but it doesn't give any result :
COMPARE_FILES() {
awk '
NR==FNR {a[FNR]=$0; next}
{
b=$0; gsub(/[0-9]+/,"",b)
c=a[FNR]; gsub(/[0-9]+/,"",c)
if (b != c) {printf "< %s\n> %s\n", $0, a[FNR]}
}' "$1" "$2"
}
Any suggestion of how i can make it work ! PS : The whitespace between the two files can be different!