Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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 ajoutée par mahmoud elnahhas , Assistant Manager , National Bank of Kuwait (NBK Egypt)
Date de publication: 2014/05/21
Akash Dubey
par 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
par Muhammad Anzar , DevOps/DevSecOps Architect , Confidential

grep -i "Tecmint" *

 

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

Vijai Ganapathy
par 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. 

 

More Questions Like This