Skip to content
Advertisement

Print grep Keyword if grep find a match

I have an input file Input.txt with the following sample keywords:

JavaScript

I also have a file Text.txt to search such as:

JavaScript

I want to print grep Keyword followed by a match if the grep finds a match.

The desired output:

JavaScript

Advertisement

Answer

With awk you could do something like this:

JavaScript

In a more readable format it would be:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement