In input file, you can see there are more space after IP address. So it should ignore that space though content is matching.
I am comparing input file enteries should be matching with the host file enteries. Host file can have more entries also but Input file enteries must be there in the host file. I am ignoring comments with that regular experssion but need to ignore spaces also.
Two things here am looking at matching a smaller set of input file against a big data file and print the contents of input file that is not part of data file.
I am looking for the strict line match. I am ignoring comments with taht regular expression and now i need to ignore the whitespace in between or after the line.
grep -vxFf datafile inputfile
is the one liner command which is doing job for me. In Awk , it might required to build the big logic to strictly match the lines and need to see also how much time it is taking in comparing file.
This code is working fine, just want to ignore whitespace also as am doing for ignoring comments.
---------- Post updated at 01:57 AM ---------- Previous update was at 01:44 AM ----------
Thanks Milan for your effort.
Actually your suggestion is trimming the spaces in the input file but I want to ingore any spaces while matching the code.
I tried your command, but it is not going through and even not throwing any error on the console.
One more question,
What I can understand is you are stroing each keyword of a line in $1, $2, $3
In some of the cases, lines will contain 5 words also and in some cases only 3. Will this solution work for it
There should be $1 FS $2 FS $3 instead of $1$2$3 . This is still a bit ugly because the "# fields for comparison" is hard-coded (here: 3).
The following is unlimited: