Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

You need to search for the string “Tecmint” in all the “.txt” files in the current directory. How will you do it?

user-image
Question added by mahmoud elnahhas , Assistant Manager , National Bank of Kuwait (NBK Egypt)
Date Posted: 2014/05/21
Akash Dubey
by Akash Dubey , Senior Technical Lead , Fulcrum Software Worldwide Pvt. Ltd.

above command won't tell which file(s)  has the word Techmint, i think more appropriate is to use grep  -n Techmint  *.txt

Muhammad Anzar
by Muhammad Anzar , DevOps/DevSecOps Architect , Confidential

grep -i "Tecmint" *

 

This will show the files if it is contained any of the file

Vijai Ganapathy
by Vijai Ganapathy , IT Architect , Hewlett-Packard Enterprise

 

$ grep -i "Techmint" *.txt, would to that for both the cases, with content and files. 

$ grep -l Techmint *.txt , would list the files containing the string. 

 

Ravi K
by Ravi K , RAKBANK

grep Tecmint *.txt

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.