Could you please do cat -v Input_file where Input_file is your files and see if you have control M characters in them in case you have them then remove them by doing tr -d '\r < Input_file > temp_file && mv temp_file Input_file and let me know then how it goes?
Yes I think at least the pattern_file is DOS format, where each search pattern have a \r at the end, but the last one, that is an incomplete line (that is completed by some versions of grep and awk; then the only the last pattern works).
Workaround: strip the trailing \r when reading from the pattern file.
Thanks so much, RavinderSingh. Thanks for all the information. I was unaware of the Ctrl M characters earlier.
I cleaned up the ^M characters from both the pattern_file.txt and input_file.txt. Then only the output showed up.
After the cleanup in both the files, even the command $ grep -Ff "pattern_file.txt" "input_file.txt" is now giving me the expected output.
Once again, Thanks a lot for providing the valuable information on the ^M characters and the AWK & cat commands for getting my issue resolved so quickly.
Thank you, MadeInGermany. The command provided by you worked, without me meddling with the files.
Once again Thanks to you both (RavinderSingh13 and MadeInGermany) for helping me with the required commands.
------ Post updated at 09:10 AM ------
RavinderSingh,
Thanks for letting me know. I just hit the Thanks button as you mentioned. I'm new here on the forum, so in the process of getting myself familiarized with the available controls on this website.