Finding multiple strings in directory using linux commends -
if have 2 strings, example "class" , "btn", linux command allow me search these 2 strings in entire directory.
to more specific, lets have directory contains few folders bunch of .php files. goal able search throughout .php files prints out files contain "class" , "btn" in 1 line. clarifies things better.
thanks,
i use following search strings inside source codes. searches string , shows exact line number text appears. helpful searching string in source code files. can pipes output grep , filter outputs.
grep -rn "text_to_search" directory_name/
example:
$ grep -rn "angular" menuapp $ grep -rn "angular" menuapp | grep some_other_string
output be:
menuapp/public/javascripts/angular.min.js:251://# sourcemappingurl=angular.min.js.map menuapp/public/javascripts/app.js:1:var app = angular.module("menuapp", []);
Comments
Post a Comment