Skip to content

Instantly share code, notes, and snippets.

@vpnwall-services
Last active April 23, 2018 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpnwall-services/22293e56b360e5c64da4a560c798cc0a to your computer and use it in GitHub Desktop.
Save vpnwall-services/22293e56b360e5c64da4a560c798cc0a to your computer and use it in GitHub Desktop.
[Find word in files] Search for a specific word in a set of folders and files #linux #search #grep
#!/bin/bash
if [ -z "$1" ]
then
echo -e "\nInfo : find word in files from specified folder"
echo -e "\nUsage : cd into target folder and then"
echo -e "\n ==> : ./find-word-in-files.sh <word to search>"
else
echo -e "\n Searching $1 in $PWD"
# grep -R {"$1"} {"$PWD"}
grep -rnw $PWD -e "$1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment